Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
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
001 <?php
002
003 /*
004 * This file is part of the Symfony package.
005 *
006 * (c) Fabien Potencier <fabien@symfony.com>
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Symfony\Component\HttpKernel\DataCollector\Util;
013
014 @trigger_error('The '.__NAMESPACE__.'\ValueExporter class is deprecated since Symfony 3.2 and will be removed in 4.0. Use the VarDumper component instead.', \E_USER_DEPRECATED);
015
016 /**
017 * @author Bernhard Schussek <bschussek@gmail.com>
018 *
019 * @deprecated since version 3.2, to be removed in 4.0. Use the VarDumper component instead.
020 */
021 class ValueExporter
022 {
023 /**
024 * Converts a PHP value to a string.
025 *
026 * @param mixed $value The PHP value
027 * @param int $depth Only for internal usage
028 * @param bool $deep Only for internal usage
029 *
030 * @return string The string representation of the given value
031 */
032 public function exportValue($value, $depth = 1, $deep = false)
033 {
034 if ($value instanceof \__PHP_Incomplete_Class) {
035 return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value));
036 }
037
038 if (\is_object($value)) {
039 if ($value instanceof \DateTimeInterface) {
040 return sprintf('Object(%s) - %s', \get_class($value), $value->format(\DateTime::ATOM));
041 }
042
043 return sprintf('Object(%s)', \get_class($value));
044 }
045
046 if (\is_array($value)) {
047 if (empty($value)) {
048 return '[]';
049 }
050
051 $indent = str_repeat(' ', $depth);
052
053 $a = [];
054 foreach ($value as $k => $v) {
055 if (\is_array($v)) {
056 $deep = true;
057 }
058 $a[] = sprintf('%s => %s', $k, $this->exportValue($v, $depth + 1, $deep));
059 }
060
061 if ($deep) {
062 return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1));
063 }
064
065 $s = sprintf('[%s]', implode(', ', $a));
066
067 if (80 > \strlen($s)) {
068 return $s;
069 }
070
071 return sprintf("[\n%s%s\n]", $indent, implode(sprintf(",\n%s", $indent), $a));
072 }
073
074 if (\is_resource($value)) {
075 return sprintf('Resource(%s#%d)', get_resource_type($value), $value);
076 }
077
078 if (null === $value) {
079 return 'null';
080 }
081
082 if (false === $value) {
083 return 'false';
084 }
085
086 if (true === $value) {
087 return 'true';
088 }
089
090 return (string) $value;
091 }
092
093 private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
094 {
095 $array = new \ArrayObject($value);
096
097 return $array['__PHP_Incomplete_Class_Name'];
098 }
099 }
100