Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ValueExporter.php
01 <?php
02
03 /*
04 * This file is part of the Symfony package.
05 *
06 * (c) Fabien Potencier <fabien@symfony.com>
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\HttpKernel\DataCollector\Util;
13
14 /**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17 class ValueExporter
18 {
19 /**
20 * Converts a PHP value to a string.
21 *
22 * @param mixed $value The PHP value
23 * @param int $depth only for internal usage
24 * @param bool $deep only for internal usage
25 *
26 * @return string The string representation of the given value
27 */
28 public function exportValue($value, $depth = 1, $deep = false)
29 {
30 if ($value instanceof \__PHP_Incomplete_Class) {
31 return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value));
32 }
33
34 if (is_object($value)) {
35 if ($value instanceof \DateTime || $value instanceof \DateTimeInterface) {
36 return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ISO8601));
37 }
38
39 return sprintf('Object(%s)', get_class($value));
40 }
41
42 if (is_array($value)) {
43 if (empty($value)) {
44 return '[]';
45 }
46
47 $indent = str_repeat(' ', $depth);
48
49 $a = array();
50 foreach ($value as $k => $v) {
51 if (is_array($v)) {
52 $deep = true;
53 }
54 $a[] = sprintf('%s => %s', $k, $this->exportValue($v, $depth + 1, $deep));
55 }
56
57 if ($deep) {
58 return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1));
59 }
60
61 return sprintf('[%s]', implode(', ', $a));
62 }
63
64 if (is_resource($value)) {
65 return sprintf('Resource(%s#%d)', get_resource_type($value), $value);
66 }
67
68 if (null === $value) {
69 return 'null';
70 }
71
72 if (false === $value) {
73 return 'false';
74 }
75
76 if (true === $value) {
77 return 'true';
78 }
79
80 return (string) $value;
81 }
82
83 private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
84 {
85 $array = new \ArrayObject($value);
86
87 return $array['__PHP_Incomplete_Class_Name'];
88 }
89 }
90