Source of file DataCollector.php
Size: 1,667 Bytes - Last Modified: 2013-07-17T08:22:21+02:00
/home/theseer/Downloads/Symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 | <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\DataCollector; /** * DataCollector. * * Children of this class must store the collected data in the data property. * * @author Fabien Potencier <fabien@symfony.com> */ abstract class DataCollector implements DataCollectorInterface, \Serializable { protected $data; public function serialize() { return serialize($this->data); } public function unserialize($data) { $this->data = unserialize($data); } /** * Converts a PHP variable to a string. * * @param mixed $var A PHP variable * * @return string The string representation of the variable */ protected function varToString($var) { if (is_object($var)) { return sprintf('Object(%s)', get_class($var)); } if (is_array($var)) { $a = array(); foreach ($var as $k => $v) { $a[] = sprintf('%s => %s', $k, $this->varToString($v)); } return sprintf("Array(%s)", implode(', ', $a)); } if (is_resource($var)) { return sprintf('Resource(%s)', get_resource_type($var)); } if (null === $var) { return 'null'; } if (false === $var) { return 'false'; } if (true === $var) { return 'true'; } return (string) $var; } } |