├── .github └── workflows │ └── deploy.yml ├── .gitignore ├── README.md ├── SECURITY.md ├── class-debug-bar-timber.php ├── composer-install.sh ├── composer.json ├── composer.lock ├── debug-bar-timber.php ├── readme.txt ├── timber-debug-bar.css └── vendor ├── autoload.php ├── bin ├── var-dump-server └── var-dump-server.bat ├── composer ├── ClassLoader.php ├── InstalledVersions.php ├── LICENSE ├── autoload_classmap.php ├── autoload_files.php ├── autoload_namespaces.php ├── autoload_psr4.php ├── autoload_real.php ├── autoload_static.php ├── installed.json ├── installed.php └── platform_check.php └── symfony ├── polyfill-mbstring ├── LICENSE ├── Mbstring.php ├── README.md ├── Resources │ └── unidata │ │ ├── lowerCase.php │ │ ├── titleCaseRegexp.php │ │ └── upperCase.php ├── bootstrap.php ├── bootstrap80.php └── composer.json ├── polyfill-php74 ├── LICENSE ├── Php74.php ├── README.md ├── bootstrap.php └── composer.json └── var-dumper ├── CHANGELOG.md ├── Caster ├── AmqpCaster.php ├── ArgsStub.php ├── Caster.php ├── ClassStub.php ├── ConstStub.php ├── CutArrayStub.php ├── CutStub.php ├── DOMCaster.php ├── DateCaster.php ├── DoctrineCaster.php ├── DsCaster.php ├── DsPairStub.php ├── EnumStub.php ├── ExceptionCaster.php ├── FrameStub.php ├── GmpCaster.php ├── ImagineCaster.php ├── ImgStub.php ├── IntlCaster.php ├── LinkStub.php ├── MemcachedCaster.php ├── PdoCaster.php ├── PgSqlCaster.php ├── ProxyManagerCaster.php ├── RdKafkaCaster.php ├── RedisCaster.php ├── ReflectionCaster.php ├── ResourceCaster.php ├── SplCaster.php ├── StubCaster.php ├── SymfonyCaster.php ├── TraceStub.php ├── UuidCaster.php ├── XmlReaderCaster.php └── XmlResourceCaster.php ├── Cloner ├── AbstractCloner.php ├── ClonerInterface.php ├── Cursor.php ├── Data.php ├── DumperInterface.php ├── Stub.php └── VarCloner.php ├── Command ├── Descriptor │ ├── CliDescriptor.php │ ├── DumpDescriptorInterface.php │ └── HtmlDescriptor.php └── ServerDumpCommand.php ├── Dumper ├── AbstractDumper.php ├── CliDumper.php ├── ContextProvider │ ├── CliContextProvider.php │ ├── ContextProviderInterface.php │ ├── RequestContextProvider.php │ └── SourceContextProvider.php ├── ContextualizedDumper.php ├── DataDumperInterface.php ├── HtmlDumper.php └── ServerDumper.php ├── Exception └── ThrowingCasterException.php ├── LICENSE ├── README.md ├── Resources ├── bin │ └── var-dump-server ├── css │ └── htmlDescriptor.css ├── functions │ └── dump.php └── js │ └── htmlDescriptor.js ├── Server ├── Connection.php └── DumpServer.php ├── Test └── VarDumperTestTrait.php ├── VarDumper.php └── composer.json /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Deploy to WordPress.org 2 | on: 3 | push: 4 | tags: 5 | - "*" 6 | jobs: 7 | tag: 8 | name: New tag 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@master 12 | - name: WordPress Plugin Deploy 13 | uses: 10up/action-wordpress-plugin-deploy@1.5.0 14 | env: 15 | SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} 16 | SVN_USERNAME: ${{ secrets.SVN_USERNAME }} 17 | SLUG: debug-bar-timber 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .idea/workspace.xml 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
Timber found template: ".$file."
. Here's the data that you sent:
{# expected variables:';
128 | $dataKeyNames = array_keys( $data );
129 | $i = 0;
130 | foreach ( $data as $d ) {
131 | if( is_array($d) ) {
132 | $varName = $dataKeyNames[$i];
133 | $arrayKeynames = array_keys((array) $d[0]);
134 | $keynames = '';
135 | foreach ( $arrayKeynames as $array_keyname ) {
136 | $keynames .= "'" . $array_keyname . "', ";
137 | }
138 | $keynames = substr($keynames, 0, -2 );
139 | echo "$varName: array of the form array[0][X] where X is $keynames";
140 | }
141 | $i++;
142 | }
143 | echo '#}
';
144 | }
145 | $i++;
146 | }
147 | }
148 | }
149 |
--------------------------------------------------------------------------------
/composer-install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | if [ -f "composer.lock" ]
4 | then
5 | rm composer.lock
6 | fi
7 |
8 | EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)"
9 | php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
10 | ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
11 |
12 | if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
13 | then
14 | >&2 echo 'ERROR: Invalid installer checksum'
15 | rm composer-setup.php
16 | exit 1
17 | fi
18 |
19 | php composer-setup.php --quiet
20 | rm composer-setup.php
21 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "repositories": [],
3 | "require": {
4 | "symfony/polyfill-php74": "^1.17",
5 | "symfony/var-dumper": "5.2.*"
6 | },
7 | "require-dev": {
8 | "roave/security-advisories": "dev-latest"
9 | },
10 | "options": {
11 | "symlink": false
12 | },
13 | "config": {
14 | "preferred-install": {
15 | "*": "dist"
16 | },
17 | "sort-packages": true
18 | },
19 | "replace": {
20 | "symfony/polyfill-php80": "*",
21 | "symfony/polyfill-php74": "*"
22 | },
23 | "name": "timber/debug-bar-timber",
24 | "description": ""
25 | }
26 |
--------------------------------------------------------------------------------
/debug-bar-timber.php:
--------------------------------------------------------------------------------
1 | WordPress Debug Bar Plugin";
30 |
31 | add_action( 'admin_notices', static function() use ( $text, $class ) {
32 | echo ''.$text.'
20 | */ 21 | class ArgsStub extends EnumStub 22 | { 23 | private static $parameters = []; 24 | 25 | public function __construct(array $args, string $function, ?string $class) 26 | { 27 | [$variadic, $params] = self::getParameters($function, $class); 28 | 29 | $values = []; 30 | foreach ($args as $k => $v) { 31 | $values[$k] = !is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v; 32 | } 33 | if (null === $params) { 34 | parent::__construct($values, false); 35 | 36 | return; 37 | } 38 | if (\count($values) < \count($params)) { 39 | $params = \array_slice($params, 0, \count($values)); 40 | } elseif (\count($values) > \count($params)) { 41 | $values[] = new EnumStub(array_splice($values, \count($params)), false); 42 | $params[] = $variadic; 43 | } 44 | if (['...'] === $params) { 45 | $this->dumpKeys = false; 46 | $this->value = $values[0]->value; 47 | } else { 48 | $this->value = array_combine($params, $values); 49 | } 50 | } 51 | 52 | private static function getParameters(string $function, ?string $class): array 53 | { 54 | if (isset(self::$parameters[$k = $class.'::'.$function])) { 55 | return self::$parameters[$k]; 56 | } 57 | 58 | try { 59 | $r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function); 60 | } catch (\ReflectionException $e) { 61 | return [null, null]; 62 | } 63 | 64 | $variadic = '...'; 65 | $params = []; 66 | foreach ($r->getParameters() as $v) { 67 | $k = '$'.$v->name; 68 | if ($v->isPassedByReference()) { 69 | $k = '&'.$k; 70 | } 71 | if ($v->isVariadic()) { 72 | $variadic .= $k; 73 | } else { 74 | $params[] = $k; 75 | } 76 | } 77 | 78 | return self::$parameters[$k] = [$variadic, $params]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /vendor/symfony/var-dumper/Caster/Caster.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Helper for filtering out properties in casters. 18 | * 19 | * @author Nicolas Grekas
20 | * 21 | * @final 22 | */ 23 | class Caster 24 | { 25 | public const EXCLUDE_VERBOSE = 1; 26 | public const EXCLUDE_VIRTUAL = 2; 27 | public const EXCLUDE_DYNAMIC = 4; 28 | public const EXCLUDE_PUBLIC = 8; 29 | public const EXCLUDE_PROTECTED = 16; 30 | public const EXCLUDE_PRIVATE = 32; 31 | public const EXCLUDE_NULL = 64; 32 | public const EXCLUDE_EMPTY = 128; 33 | public const EXCLUDE_NOT_IMPORTANT = 256; 34 | public const EXCLUDE_STRICT = 512; 35 | 36 | public const PREFIX_VIRTUAL = "\0~\0"; 37 | public const PREFIX_DYNAMIC = "\0+\0"; 38 | public const PREFIX_PROTECTED = "\0*\0"; 39 | 40 | /** 41 | * Casts objects to arrays and adds the dynamic property prefix. 42 | * 43 | * @param bool $hasDebugInfo Whether the __debugInfo method exists on $obj or not 44 | * 45 | * @return array The array-cast of the object, with prefixed dynamic properties 46 | */ 47 | public static function castObject(object $obj, string $class, bool $hasDebugInfo = false, string $debugClass = null): array 48 | { 49 | if ($hasDebugInfo) { 50 | try { 51 | $debugInfo = $obj->__debugInfo(); 52 | } catch (\Exception $e) { 53 | // ignore failing __debugInfo() 54 | $hasDebugInfo = false; 55 | } 56 | } 57 | 58 | $a = $obj instanceof \Closure ? [] : (array) $obj; 59 | 60 | if ($obj instanceof \__PHP_Incomplete_Class) { 61 | return $a; 62 | } 63 | 64 | if ($a) { 65 | static $publicProperties = []; 66 | $debugClass = $debugClass ?? get_debug_type($obj); 67 | 68 | $i = 0; 69 | $prefixedKeys = []; 70 | foreach ($a as $k => $v) { 71 | if ("\0" !== ($k[0] ?? '')) { 72 | if (!isset($publicProperties[$class])) { 73 | foreach ((new \ReflectionClass($class))->getProperties(\ReflectionProperty::IS_PUBLIC) as $prop) { 74 | $publicProperties[$class][$prop->name] = true; 75 | } 76 | } 77 | if (!isset($publicProperties[$class][$k])) { 78 | $prefixedKeys[$i] = self::PREFIX_DYNAMIC.$k; 79 | } 80 | } elseif ($debugClass !== $class && 1 === strpos($k, $class)) { 81 | $prefixedKeys[$i] = "\0".$debugClass.strrchr($k, "\0"); 82 | } 83 | ++$i; 84 | } 85 | if ($prefixedKeys) { 86 | $keys = array_keys($a); 87 | foreach ($prefixedKeys as $i => $k) { 88 | $keys[$i] = $k; 89 | } 90 | $a = array_combine($keys, $a); 91 | } 92 | } 93 | 94 | if ($hasDebugInfo && \is_array($debugInfo)) { 95 | foreach ($debugInfo as $k => $v) { 96 | if (!isset($k[0]) || "\0" !== $k[0]) { 97 | if (\array_key_exists(self::PREFIX_DYNAMIC.$k, $a)) { 98 | continue; 99 | } 100 | $k = self::PREFIX_VIRTUAL.$k; 101 | } 102 | 103 | unset($a[$k]); 104 | $a[$k] = $v; 105 | } 106 | } 107 | 108 | return $a; 109 | } 110 | 111 | /** 112 | * Filters out the specified properties. 113 | * 114 | * By default, a single match in the $filter bit field filters properties out, following an "or" logic. 115 | * When EXCLUDE_STRICT is set, an "and" logic is applied: all bits must match for a property to be removed. 116 | * 117 | * @param array $a The array containing the properties to filter 118 | * @param int $filter A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out 119 | * @param string[] $listedProperties List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set 120 | * @param int &$count Set to the number of removed properties 121 | * 122 | * @return array The filtered array 123 | */ 124 | public static function filter(array $a, int $filter, array $listedProperties = [], ?int &$count = 0): array 125 | { 126 | $count = 0; 127 | 128 | foreach ($a as $k => $v) { 129 | $type = self::EXCLUDE_STRICT & $filter; 130 | 131 | if (null === $v) { 132 | $type |= self::EXCLUDE_NULL & $filter; 133 | $type |= self::EXCLUDE_EMPTY & $filter; 134 | } elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || [] === $v) { 135 | $type |= self::EXCLUDE_EMPTY & $filter; 136 | } 137 | if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !\in_array($k, $listedProperties, true)) { 138 | $type |= self::EXCLUDE_NOT_IMPORTANT; 139 | } 140 | if ((self::EXCLUDE_VERBOSE & $filter) && \in_array($k, $listedProperties, true)) { 141 | $type |= self::EXCLUDE_VERBOSE; 142 | } 143 | 144 | if (!isset($k[1]) || "\0" !== $k[0]) { 145 | $type |= self::EXCLUDE_PUBLIC & $filter; 146 | } elseif ('~' === $k[1]) { 147 | $type |= self::EXCLUDE_VIRTUAL & $filter; 148 | } elseif ('+' === $k[1]) { 149 | $type |= self::EXCLUDE_DYNAMIC & $filter; 150 | } elseif ('*' === $k[1]) { 151 | $type |= self::EXCLUDE_PROTECTED & $filter; 152 | } else { 153 | $type |= self::EXCLUDE_PRIVATE & $filter; 154 | } 155 | 156 | if ((self::EXCLUDE_STRICT & $filter) ? $type === $filter : $type) { 157 | unset($a[$k]); 158 | ++$count; 159 | } 160 | } 161 | 162 | return $a; 163 | } 164 | 165 | public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, bool $isNested): array 166 | { 167 | if (isset($a['__PHP_Incomplete_Class_Name'])) { 168 | $stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')'; 169 | unset($a['__PHP_Incomplete_Class_Name']); 170 | } 171 | 172 | return $a; 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /vendor/symfony/var-dumper/Caster/ClassStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Represents a PHP class identifier. 18 | * 19 | * @author Nicolas Grekas
20 | */ 21 | class ClassStub extends ConstStub 22 | { 23 | /** 24 | * @param string $identifier A PHP identifier, e.g. a class, method, interface, etc. name 25 | * @param callable $callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier 26 | */ 27 | public function __construct(string $identifier, $callable = null) 28 | { 29 | $this->value = $identifier; 30 | 31 | try { 32 | if (null !== $callable) { 33 | if ($callable instanceof \Closure) { 34 | $r = new \ReflectionFunction($callable); 35 | } elseif (\is_object($callable)) { 36 | $r = [$callable, '__invoke']; 37 | } elseif (\is_array($callable)) { 38 | $r = $callable; 39 | } elseif (false !== $i = strpos($callable, '::')) { 40 | $r = [substr($callable, 0, $i), substr($callable, 2 + $i)]; 41 | } else { 42 | $r = new \ReflectionFunction($callable); 43 | } 44 | } elseif (0 < $i = strpos($identifier, '::') ?: strpos($identifier, '->')) { 45 | $r = [substr($identifier, 0, $i), substr($identifier, 2 + $i)]; 46 | } else { 47 | $r = new \ReflectionClass($identifier); 48 | } 49 | 50 | if (\is_array($r)) { 51 | try { 52 | $r = new \ReflectionMethod($r[0], $r[1]); 53 | } catch (\ReflectionException $e) { 54 | $r = new \ReflectionClass($r[0]); 55 | } 56 | } 57 | 58 | if (str_contains($identifier, "@anonymous\0")) { 59 | $this->value = $identifier = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) { 60 | return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0]; 61 | }, $identifier); 62 | } 63 | 64 | if (null !== $callable && $r instanceof \ReflectionFunctionAbstract) { 65 | $s = ReflectionCaster::castFunctionAbstract($r, [], new Stub(), true, Caster::EXCLUDE_VERBOSE); 66 | $s = ReflectionCaster::getSignature($s); 67 | 68 | if (str_ends_with($identifier, '()')) { 69 | $this->value = substr_replace($identifier, $s, -2); 70 | } else { 71 | $this->value .= $s; 72 | } 73 | } 74 | } catch (\ReflectionException $e) { 75 | return; 76 | } finally { 77 | if (0 < $i = strrpos($this->value, '\\')) { 78 | $this->attr['ellipsis'] = \strlen($this->value) - $i; 79 | $this->attr['ellipsis-type'] = 'class'; 80 | $this->attr['ellipsis-tail'] = 1; 81 | } 82 | } 83 | 84 | if ($f = $r->getFileName()) { 85 | $this->attr['file'] = $f; 86 | $this->attr['line'] = $r->getStartLine(); 87 | } 88 | } 89 | 90 | public static function wrapCallable($callable) 91 | { 92 | if (\is_object($callable) || !\is_callable($callable)) { 93 | return $callable; 94 | } 95 | 96 | if (!\is_array($callable)) { 97 | $callable = new static($callable, $callable); 98 | } elseif (\is_string($callable[0])) { 99 | $callable[0] = new static($callable[0], $callable); 100 | } else { 101 | $callable[1] = new static($callable[1], $callable); 102 | } 103 | 104 | return $callable; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /vendor/symfony/var-dumper/Caster/ConstStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Represents a PHP constant and its value. 18 | * 19 | * @author Nicolas Grekas
20 | */ 21 | class ConstStub extends Stub 22 | { 23 | public function __construct(string $name, $value = null) 24 | { 25 | $this->class = $name; 26 | $this->value = 1 < \func_num_args() ? $value : $name; 27 | } 28 | 29 | /** 30 | * @return string 31 | */ 32 | public function __toString() 33 | { 34 | return (string) $this->value; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /vendor/symfony/var-dumper/Caster/CutArrayStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | /** 15 | * Represents a cut array. 16 | * 17 | * @author Nicolas Grekas
18 | */ 19 | class CutArrayStub extends CutStub 20 | { 21 | public $preservedSubset; 22 | 23 | public function __construct(array $value, array $preservedKeys) 24 | { 25 | parent::__construct($value); 26 | 27 | $this->preservedSubset = array_intersect_key($value, array_flip($preservedKeys)); 28 | $this->cut -= \count($this->preservedSubset); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /vendor/symfony/var-dumper/Caster/CutStub.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\VarDumper\Caster; 13 | 14 | use Symfony\Component\VarDumper\Cloner\Stub; 15 | 16 | /** 17 | * Represents the main properties of a PHP variable, pre-casted by a caster. 18 | * 19 | * @author Nicolas Grekas
20 | */
21 | class CutStub extends Stub
22 | {
23 | public function __construct($value)
24 | {
25 | $this->value = $value;
26 |
27 | switch (\gettype($value)) {
28 | case 'object':
29 | $this->type = self::TYPE_OBJECT;
30 | $this->class = \get_class($value);
31 |
32 | if ($value instanceof \Closure) {
33 | ReflectionCaster::castClosure($value, [], $this, true, Caster::EXCLUDE_VERBOSE);
34 | }
35 |
36 | $this->cut = -1;
37 | break;
38 |
39 | case 'array':
40 | $this->type = self::TYPE_ARRAY;
41 | $this->class = self::ARRAY_ASSOC;
42 | $this->cut = $this->value = \count($value);
43 | break;
44 |
45 | case 'resource':
46 | case 'unknown type':
47 | case 'resource (closed)':
48 | $this->type = self::TYPE_RESOURCE;
49 | $this->handle = (int) $value;
50 | if ('Unknown' === $this->class = @get_resource_type($value)) {
51 | $this->class = 'Closed';
52 | }
53 | $this->cut = -1;
54 | break;
55 |
56 | case 'string':
57 | $this->type = self::TYPE_STRING;
58 | $this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY;
59 | $this->cut = self::STRING_BINARY === $this->class ? \strlen($value) : mb_strlen($value, 'UTF-8');
60 | $this->value = '';
61 | break;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/DateCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Stub;
15 |
16 | /**
17 | * Casts DateTimeInterface related classes to array representation.
18 | *
19 | * @author Dany Maillard
23 | *
24 | * @final
25 | */
26 | class DoctrineCaster
27 | {
28 | public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, bool $isNested)
29 | {
30 | foreach (['__cloner__', '__initializer__'] as $k) {
31 | if (\array_key_exists($k, $a)) {
32 | unset($a[$k]);
33 | ++$stub->cut;
34 | }
35 | }
36 |
37 | return $a;
38 | }
39 |
40 | public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, bool $isNested)
41 | {
42 | foreach (['_entityPersister', '_identifier'] as $k) {
43 | if (\array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
44 | unset($a[$k]);
45 | ++$stub->cut;
46 | }
47 | }
48 |
49 | return $a;
50 | }
51 |
52 | public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, bool $isNested)
53 | {
54 | foreach (['snapshot', 'association', 'typeClass'] as $k) {
55 | if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
56 | $a[$k] = new CutStub($a[$k]);
57 | }
58 | }
59 |
60 | return $a;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/DsCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Ds\Collection;
15 | use Ds\Map;
16 | use Ds\Pair;
17 | use Symfony\Component\VarDumper\Cloner\Stub;
18 |
19 | /**
20 | * Casts Ds extension classes to array representation.
21 | *
22 | * @author Jáchym Toušek
18 | */
19 | class DsPairStub extends Stub
20 | {
21 | public function __construct($key, $value)
22 | {
23 | $this->value = [
24 | Caster::PREFIX_VIRTUAL.'key' => $key,
25 | Caster::PREFIX_VIRTUAL.'value' => $value,
26 | ];
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/EnumStub.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Stub;
15 |
16 | /**
17 | * Represents an enumeration of values.
18 | *
19 | * @author Nicolas Grekas
20 | */
21 | class EnumStub extends Stub
22 | {
23 | public $dumpKeys = true;
24 |
25 | public function __construct(array $values, bool $dumpKeys = true)
26 | {
27 | $this->value = $values;
28 | $this->dumpKeys = $dumpKeys;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/FrameStub.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | /**
15 | * Represents a single backtrace frame as returned by debug_backtrace() or Exception->getTrace().
16 | *
17 | * @author Nicolas Grekas
18 | */
19 | class FrameStub extends EnumStub
20 | {
21 | public $keepArgs;
22 | public $inTraceStub;
23 |
24 | public function __construct(array $frame, bool $keepArgs = true, bool $inTraceStub = false)
25 | {
26 | $this->value = $frame;
27 | $this->keepArgs = $keepArgs;
28 | $this->inTraceStub = $inTraceStub;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/GmpCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Stub;
15 |
16 | /**
17 | * Casts GMP objects to array representation.
18 | *
19 | * @author Hamza Amrouche
21 | *
22 | * @final
23 | */
24 | class GmpCaster
25 | {
26 | public static function castGmp(\GMP $gmp, array $a, Stub $stub, bool $isNested, int $filter): array
27 | {
28 | $a[Caster::PREFIX_VIRTUAL.'value'] = new ConstStub(gmp_strval($gmp), gmp_strval($gmp));
29 |
30 | return $a;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/ImagineCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Imagine\Image\ImageInterface;
15 | use Symfony\Component\VarDumper\Cloner\Stub;
16 |
17 | /**
18 | * @author Grégoire Pineau
18 | */
19 | class LinkStub extends ConstStub
20 | {
21 | public $inVendor = false;
22 |
23 | private static $vendorRoots;
24 | private static $composerRoots;
25 |
26 | public function __construct(string $label, int $line = 0, string $href = null)
27 | {
28 | $this->value = $label;
29 |
30 | if (null === $href) {
31 | $href = $label;
32 | }
33 | if (!\is_string($href)) {
34 | return;
35 | }
36 | if (str_starts_with($href, 'file://')) {
37 | if ($href === $label) {
38 | $label = substr($label, 7);
39 | }
40 | $href = substr($href, 7);
41 | } elseif (str_contains($href, '://')) {
42 | $this->attr['href'] = $href;
43 |
44 | return;
45 | }
46 | if (!is_file($href)) {
47 | return;
48 | }
49 | if ($line) {
50 | $this->attr['line'] = $line;
51 | }
52 | if ($label !== $this->attr['file'] = realpath($href) ?: $href) {
53 | return;
54 | }
55 | if ($composerRoot = $this->getComposerRoot($href, $this->inVendor)) {
56 | $this->attr['ellipsis'] = \strlen($href) - \strlen($composerRoot) + 1;
57 | $this->attr['ellipsis-type'] = 'path';
58 | $this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + \strlen(implode('', \array_slice(explode(\DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0);
59 | } elseif (3 < \count($ellipsis = explode(\DIRECTORY_SEPARATOR, $href))) {
60 | $this->attr['ellipsis'] = 2 + \strlen(implode('', \array_slice($ellipsis, -2)));
61 | $this->attr['ellipsis-type'] = 'path';
62 | $this->attr['ellipsis-tail'] = 1;
63 | }
64 | }
65 |
66 | private function getComposerRoot(string $file, bool &$inVendor)
67 | {
68 | if (null === self::$vendorRoots) {
69 | self::$vendorRoots = [];
70 |
71 | foreach (get_declared_classes() as $class) {
72 | if ('C' === $class[0] && str_starts_with($class, 'ComposerAutoloaderInit')) {
73 | $r = new \ReflectionClass($class);
74 | $v = \dirname($r->getFileName(), 2);
75 | if (is_file($v.'/composer/installed.json')) {
76 | self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR;
77 | }
78 | }
79 | }
80 | }
81 | $inVendor = false;
82 |
83 | if (isset(self::$composerRoots[$dir = \dirname($file)])) {
84 | return self::$composerRoots[$dir];
85 | }
86 |
87 | foreach (self::$vendorRoots as $root) {
88 | if ($inVendor = str_starts_with($file, $root)) {
89 | return $root;
90 | }
91 | }
92 |
93 | $parent = $dir;
94 | while (!@is_file($parent.'/composer.json')) {
95 | if (!@file_exists($parent)) {
96 | // open_basedir restriction in effect
97 | break;
98 | }
99 | if ($parent === \dirname($parent)) {
100 | return self::$composerRoots[$dir] = false;
101 | }
102 |
103 | $parent = \dirname($parent);
104 | }
105 |
106 | return self::$composerRoots[$dir] = $parent.\DIRECTORY_SEPARATOR;
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/MemcachedCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Stub;
15 |
16 | /**
17 | * @author Jan Schädlich
20 | *
21 | * @final
22 | */
23 | class PdoCaster
24 | {
25 | private const PDO_ATTRIBUTES = [
26 | 'CASE' => [
27 | \PDO::CASE_LOWER => 'LOWER',
28 | \PDO::CASE_NATURAL => 'NATURAL',
29 | \PDO::CASE_UPPER => 'UPPER',
30 | ],
31 | 'ERRMODE' => [
32 | \PDO::ERRMODE_SILENT => 'SILENT',
33 | \PDO::ERRMODE_WARNING => 'WARNING',
34 | \PDO::ERRMODE_EXCEPTION => 'EXCEPTION',
35 | ],
36 | 'TIMEOUT',
37 | 'PREFETCH',
38 | 'AUTOCOMMIT',
39 | 'PERSISTENT',
40 | 'DRIVER_NAME',
41 | 'SERVER_INFO',
42 | 'ORACLE_NULLS' => [
43 | \PDO::NULL_NATURAL => 'NATURAL',
44 | \PDO::NULL_EMPTY_STRING => 'EMPTY_STRING',
45 | \PDO::NULL_TO_STRING => 'TO_STRING',
46 | ],
47 | 'CLIENT_VERSION',
48 | 'SERVER_VERSION',
49 | 'STATEMENT_CLASS',
50 | 'EMULATE_PREPARES',
51 | 'CONNECTION_STATUS',
52 | 'STRINGIFY_FETCHES',
53 | 'DEFAULT_FETCH_MODE' => [
54 | \PDO::FETCH_ASSOC => 'ASSOC',
55 | \PDO::FETCH_BOTH => 'BOTH',
56 | \PDO::FETCH_LAZY => 'LAZY',
57 | \PDO::FETCH_NUM => 'NUM',
58 | \PDO::FETCH_OBJ => 'OBJ',
59 | ],
60 | ];
61 |
62 | public static function castPdo(\PDO $c, array $a, Stub $stub, bool $isNested)
63 | {
64 | $attr = [];
65 | $errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
66 | $c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
67 |
68 | foreach (self::PDO_ATTRIBUTES as $k => $v) {
69 | if (!isset($k[0])) {
70 | $k = $v;
71 | $v = [];
72 | }
73 |
74 | try {
75 | $attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(\constant('PDO::ATTR_'.$k));
76 | if ($v && isset($v[$attr[$k]])) {
77 | $attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]);
78 | }
79 | } catch (\Exception $e) {
80 | }
81 | }
82 | if (isset($attr[$k = 'STATEMENT_CLASS'][1])) {
83 | if ($attr[$k][1]) {
84 | $attr[$k][1] = new ArgsStub($attr[$k][1], '__construct', $attr[$k][0]);
85 | }
86 | $attr[$k][0] = new ClassStub($attr[$k][0]);
87 | }
88 |
89 | $prefix = Caster::PREFIX_VIRTUAL;
90 | $a += [
91 | $prefix.'inTransaction' => method_exists($c, 'inTransaction'),
92 | $prefix.'errorInfo' => $c->errorInfo(),
93 | $prefix.'attributes' => new EnumStub($attr),
94 | ];
95 |
96 | if ($a[$prefix.'inTransaction']) {
97 | $a[$prefix.'inTransaction'] = $c->inTransaction();
98 | } else {
99 | unset($a[$prefix.'inTransaction']);
100 | }
101 |
102 | if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
103 | unset($a[$prefix.'errorInfo']);
104 | }
105 |
106 | $c->setAttribute(\PDO::ATTR_ERRMODE, $errmode);
107 |
108 | return $a;
109 | }
110 |
111 | public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, bool $isNested)
112 | {
113 | $prefix = Caster::PREFIX_VIRTUAL;
114 | $a[$prefix.'errorInfo'] = $c->errorInfo();
115 |
116 | if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
117 | unset($a[$prefix.'errorInfo']);
118 | }
119 |
120 | return $a;
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/PgSqlCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Stub;
15 |
16 | /**
17 | * Casts pqsql resources to array representation.
18 | *
19 | * @author Nicolas Grekas
20 | *
21 | * @final
22 | */
23 | class PgSqlCaster
24 | {
25 | private const PARAM_CODES = [
26 | 'server_encoding',
27 | 'client_encoding',
28 | 'is_superuser',
29 | 'session_authorization',
30 | 'DateStyle',
31 | 'TimeZone',
32 | 'IntervalStyle',
33 | 'integer_datetimes',
34 | 'application_name',
35 | 'standard_conforming_strings',
36 | ];
37 |
38 | private const TRANSACTION_STATUS = [
39 | \PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE',
40 | \PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE',
41 | \PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS',
42 | \PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR',
43 | \PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN',
44 | ];
45 |
46 | private const RESULT_STATUS = [
47 | \PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY',
48 | \PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK',
49 | \PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK',
50 | \PGSQL_COPY_OUT => 'PGSQL_COPY_OUT',
51 | \PGSQL_COPY_IN => 'PGSQL_COPY_IN',
52 | \PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE',
53 | \PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR',
54 | \PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR',
55 | ];
56 |
57 | private const DIAG_CODES = [
58 | 'severity' => \PGSQL_DIAG_SEVERITY,
59 | 'sqlstate' => \PGSQL_DIAG_SQLSTATE,
60 | 'message' => \PGSQL_DIAG_MESSAGE_PRIMARY,
61 | 'detail' => \PGSQL_DIAG_MESSAGE_DETAIL,
62 | 'hint' => \PGSQL_DIAG_MESSAGE_HINT,
63 | 'statement position' => \PGSQL_DIAG_STATEMENT_POSITION,
64 | 'internal position' => \PGSQL_DIAG_INTERNAL_POSITION,
65 | 'internal query' => \PGSQL_DIAG_INTERNAL_QUERY,
66 | 'context' => \PGSQL_DIAG_CONTEXT,
67 | 'file' => \PGSQL_DIAG_SOURCE_FILE,
68 | 'line' => \PGSQL_DIAG_SOURCE_LINE,
69 | 'function' => \PGSQL_DIAG_SOURCE_FUNCTION,
70 | ];
71 |
72 | public static function castLargeObject($lo, array $a, Stub $stub, bool $isNested)
73 | {
74 | $a['seek position'] = pg_lo_tell($lo);
75 |
76 | return $a;
77 | }
78 |
79 | public static function castLink($link, array $a, Stub $stub, bool $isNested)
80 | {
81 | $a['status'] = pg_connection_status($link);
82 | $a['status'] = new ConstStub(\PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
83 | $a['busy'] = pg_connection_busy($link);
84 |
85 | $a['transaction'] = pg_transaction_status($link);
86 | if (isset(self::TRANSACTION_STATUS[$a['transaction']])) {
87 | $a['transaction'] = new ConstStub(self::TRANSACTION_STATUS[$a['transaction']], $a['transaction']);
88 | }
89 |
90 | $a['pid'] = pg_get_pid($link);
91 | $a['last error'] = pg_last_error($link);
92 | $a['last notice'] = pg_last_notice($link);
93 | $a['host'] = pg_host($link);
94 | $a['port'] = pg_port($link);
95 | $a['dbname'] = pg_dbname($link);
96 | $a['options'] = pg_options($link);
97 | $a['version'] = pg_version($link);
98 |
99 | foreach (self::PARAM_CODES as $v) {
100 | if (false !== $s = pg_parameter_status($link, $v)) {
101 | $a['param'][$v] = $s;
102 | }
103 | }
104 |
105 | $a['param']['client_encoding'] = pg_client_encoding($link);
106 | $a['param'] = new EnumStub($a['param']);
107 |
108 | return $a;
109 | }
110 |
111 | public static function castResult($result, array $a, Stub $stub, bool $isNested)
112 | {
113 | $a['num rows'] = pg_num_rows($result);
114 | $a['status'] = pg_result_status($result);
115 | if (isset(self::RESULT_STATUS[$a['status']])) {
116 | $a['status'] = new ConstStub(self::RESULT_STATUS[$a['status']], $a['status']);
117 | }
118 | $a['command-completion tag'] = pg_result_status($result, \PGSQL_STATUS_STRING);
119 |
120 | if (-1 === $a['num rows']) {
121 | foreach (self::DIAG_CODES as $k => $v) {
122 | $a['error'][$k] = pg_result_error_field($result, $v);
123 | }
124 | }
125 |
126 | $a['affected rows'] = pg_affected_rows($result);
127 | $a['last OID'] = pg_last_oid($result);
128 |
129 | $fields = pg_num_fields($result);
130 |
131 | for ($i = 0; $i < $fields; ++$i) {
132 | $field = [
133 | 'name' => pg_field_name($result, $i),
134 | 'table' => sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)),
135 | 'type' => sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)),
136 | 'nullable' => (bool) pg_field_is_null($result, $i),
137 | 'storage' => pg_field_size($result, $i).' bytes',
138 | 'display' => pg_field_prtlen($result, $i).' chars',
139 | ];
140 | if (' (OID: )' === $field['table']) {
141 | $field['table'] = null;
142 | }
143 | if ('-1 bytes' === $field['storage']) {
144 | $field['storage'] = 'variable size';
145 | } elseif ('1 bytes' === $field['storage']) {
146 | $field['storage'] = '1 byte';
147 | }
148 | if ('1 chars' === $field['display']) {
149 | $field['display'] = '1 char';
150 | }
151 | $a['fields'][] = new EnumStub($field);
152 | }
153 |
154 | return $a;
155 | }
156 | }
157 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/ProxyManagerCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use ProxyManager\Proxy\ProxyInterface;
15 | use Symfony\Component\VarDumper\Cloner\Stub;
16 |
17 | /**
18 | * @author Nicolas Grekas
19 | *
20 | * @final
21 | */
22 | class ProxyManagerCaster
23 | {
24 | public static function castProxy(ProxyInterface $c, array $a, Stub $stub, bool $isNested)
25 | {
26 | if ($parent = get_parent_class($c)) {
27 | $stub->class .= ' - '.$parent;
28 | }
29 | $stub->class .= '@proxy';
30 |
31 | return $a;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/RdKafkaCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use RdKafka\Conf;
15 | use RdKafka\Exception as RdKafkaException;
16 | use RdKafka\KafkaConsumer;
17 | use RdKafka\Message;
18 | use RdKafka\Metadata\Broker as BrokerMetadata;
19 | use RdKafka\Metadata\Collection as CollectionMetadata;
20 | use RdKafka\Metadata\Partition as PartitionMetadata;
21 | use RdKafka\Metadata\Topic as TopicMetadata;
22 | use RdKafka\Topic;
23 | use RdKafka\TopicConf;
24 | use RdKafka\TopicPartition;
25 | use Symfony\Component\VarDumper\Cloner\Stub;
26 |
27 | /**
28 | * Casts RdKafka related classes to array representation.
29 | *
30 | * @author Romain Neutron
20 | *
21 | * @final
22 | */
23 | class RedisCaster
24 | {
25 | private const SERIALIZERS = [
26 | \Redis::SERIALIZER_NONE => 'NONE',
27 | \Redis::SERIALIZER_PHP => 'PHP',
28 | 2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY
29 | ];
30 |
31 | private const MODES = [
32 | \Redis::ATOMIC => 'ATOMIC',
33 | \Redis::MULTI => 'MULTI',
34 | \Redis::PIPELINE => 'PIPELINE',
35 | ];
36 |
37 | private const COMPRESSION_MODES = [
38 | 0 => 'NONE', // Redis::COMPRESSION_NONE
39 | 1 => 'LZF', // Redis::COMPRESSION_LZF
40 | ];
41 |
42 | private const FAILOVER_OPTIONS = [
43 | \RedisCluster::FAILOVER_NONE => 'NONE',
44 | \RedisCluster::FAILOVER_ERROR => 'ERROR',
45 | \RedisCluster::FAILOVER_DISTRIBUTE => 'DISTRIBUTE',
46 | \RedisCluster::FAILOVER_DISTRIBUTE_SLAVES => 'DISTRIBUTE_SLAVES',
47 | ];
48 |
49 | public static function castRedis(\Redis $c, array $a, Stub $stub, bool $isNested)
50 | {
51 | $prefix = Caster::PREFIX_VIRTUAL;
52 |
53 | if (!$connected = $c->isConnected()) {
54 | return $a + [
55 | $prefix.'isConnected' => $connected,
56 | ];
57 | }
58 |
59 | $mode = $c->getMode();
60 |
61 | return $a + [
62 | $prefix.'isConnected' => $connected,
63 | $prefix.'host' => $c->getHost(),
64 | $prefix.'port' => $c->getPort(),
65 | $prefix.'auth' => $c->getAuth(),
66 | $prefix.'mode' => isset(self::MODES[$mode]) ? new ConstStub(self::MODES[$mode], $mode) : $mode,
67 | $prefix.'dbNum' => $c->getDbNum(),
68 | $prefix.'timeout' => $c->getTimeout(),
69 | $prefix.'lastError' => $c->getLastError(),
70 | $prefix.'persistentId' => $c->getPersistentID(),
71 | $prefix.'options' => self::getRedisOptions($c),
72 | ];
73 | }
74 |
75 | public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, bool $isNested)
76 | {
77 | $prefix = Caster::PREFIX_VIRTUAL;
78 |
79 | return $a + [
80 | $prefix.'hosts' => $c->_hosts(),
81 | $prefix.'function' => ClassStub::wrapCallable($c->_function()),
82 | $prefix.'lastError' => $c->getLastError(),
83 | $prefix.'options' => self::getRedisOptions($c),
84 | ];
85 | }
86 |
87 | public static function castRedisCluster(\RedisCluster $c, array $a, Stub $stub, bool $isNested)
88 | {
89 | $prefix = Caster::PREFIX_VIRTUAL;
90 | $failover = $c->getOption(\RedisCluster::OPT_SLAVE_FAILOVER);
91 |
92 | $a += [
93 | $prefix.'_masters' => $c->_masters(),
94 | $prefix.'_redir' => $c->_redir(),
95 | $prefix.'mode' => new ConstStub($c->getMode() ? 'MULTI' : 'ATOMIC', $c->getMode()),
96 | $prefix.'lastError' => $c->getLastError(),
97 | $prefix.'options' => self::getRedisOptions($c, [
98 | 'SLAVE_FAILOVER' => isset(self::FAILOVER_OPTIONS[$failover]) ? new ConstStub(self::FAILOVER_OPTIONS[$failover], $failover) : $failover,
99 | ]),
100 | ];
101 |
102 | return $a;
103 | }
104 |
105 | /**
106 | * @param \Redis|\RedisArray|\RedisCluster $redis
107 | */
108 | private static function getRedisOptions($redis, array $options = []): EnumStub
109 | {
110 | $serializer = $redis->getOption(\Redis::OPT_SERIALIZER);
111 | if (\is_array($serializer)) {
112 | foreach ($serializer as &$v) {
113 | if (isset(self::SERIALIZERS[$v])) {
114 | $v = new ConstStub(self::SERIALIZERS[$v], $v);
115 | }
116 | }
117 | } elseif (isset(self::SERIALIZERS[$serializer])) {
118 | $serializer = new ConstStub(self::SERIALIZERS[$serializer], $serializer);
119 | }
120 |
121 | $compression = \defined('Redis::OPT_COMPRESSION') ? $redis->getOption(\Redis::OPT_COMPRESSION) : 0;
122 | if (\is_array($compression)) {
123 | foreach ($compression as &$v) {
124 | if (isset(self::COMPRESSION_MODES[$v])) {
125 | $v = new ConstStub(self::COMPRESSION_MODES[$v], $v);
126 | }
127 | }
128 | } elseif (isset(self::COMPRESSION_MODES[$compression])) {
129 | $compression = new ConstStub(self::COMPRESSION_MODES[$compression], $compression);
130 | }
131 |
132 | $retry = \defined('Redis::OPT_SCAN') ? $redis->getOption(\Redis::OPT_SCAN) : 0;
133 | if (\is_array($retry)) {
134 | foreach ($retry as &$v) {
135 | $v = new ConstStub($v ? 'RETRY' : 'NORETRY', $v);
136 | }
137 | } else {
138 | $retry = new ConstStub($retry ? 'RETRY' : 'NORETRY', $retry);
139 | }
140 |
141 | $options += [
142 | 'TCP_KEEPALIVE' => \defined('Redis::OPT_TCP_KEEPALIVE') ? $redis->getOption(\Redis::OPT_TCP_KEEPALIVE) : 0,
143 | 'READ_TIMEOUT' => $redis->getOption(\Redis::OPT_READ_TIMEOUT),
144 | 'COMPRESSION' => $compression,
145 | 'SERIALIZER' => $serializer,
146 | 'PREFIX' => $redis->getOption(\Redis::OPT_PREFIX),
147 | 'SCAN' => $retry,
148 | ];
149 |
150 | return new EnumStub($options);
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/ResourceCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Stub;
15 |
16 | /**
17 | * Casts common resource types to array representation.
18 | *
19 | * @author Nicolas Grekas
20 | *
21 | * @final
22 | */
23 | class ResourceCaster
24 | {
25 | /**
26 | * @param \CurlHandle|resource $h
27 | *
28 | * @return array
29 | */
30 | public static function castCurl($h, array $a, Stub $stub, bool $isNested)
31 | {
32 | return curl_getinfo($h);
33 | }
34 |
35 | public static function castDba($dba, array $a, Stub $stub, bool $isNested)
36 | {
37 | $list = dba_list();
38 | $a['file'] = $list[(int) $dba];
39 |
40 | return $a;
41 | }
42 |
43 | public static function castProcess($process, array $a, Stub $stub, bool $isNested)
44 | {
45 | return proc_get_status($process);
46 | }
47 |
48 | public static function castStream($stream, array $a, Stub $stub, bool $isNested)
49 | {
50 | $a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
51 | if ($a['uri'] ?? false) {
52 | $a['uri'] = new LinkStub($a['uri']);
53 | }
54 |
55 | return $a;
56 | }
57 |
58 | public static function castStreamContext($stream, array $a, Stub $stub, bool $isNested)
59 | {
60 | return @stream_context_get_params($stream) ?: $a;
61 | }
62 |
63 | public static function castGd($gd, array $a, Stub $stub, bool $isNested)
64 | {
65 | $a['size'] = imagesx($gd).'x'.imagesy($gd);
66 | $a['trueColor'] = imageistruecolor($gd);
67 |
68 | return $a;
69 | }
70 |
71 | public static function castMysqlLink($h, array $a, Stub $stub, bool $isNested)
72 | {
73 | $a['host'] = mysql_get_host_info($h);
74 | $a['protocol'] = mysql_get_proto_info($h);
75 | $a['server'] = mysql_get_server_info($h);
76 |
77 | return $a;
78 | }
79 |
80 | public static function castOpensslX509($h, array $a, Stub $stub, bool $isNested)
81 | {
82 | $stub->cut = -1;
83 | $info = openssl_x509_parse($h, false);
84 |
85 | $pin = openssl_pkey_get_public($h);
86 | $pin = openssl_pkey_get_details($pin)['key'];
87 | $pin = \array_slice(explode("\n", $pin), 1, -2);
88 | $pin = base64_decode(implode('', $pin));
89 | $pin = base64_encode(hash('sha256', $pin, true));
90 |
91 | $a += [
92 | 'subject' => new EnumStub(array_intersect_key($info['subject'], ['organizationName' => true, 'commonName' => true])),
93 | 'issuer' => new EnumStub(array_intersect_key($info['issuer'], ['organizationName' => true, 'commonName' => true])),
94 | 'expiry' => new ConstStub(date(\DateTime::ISO8601, $info['validTo_time_t']), $info['validTo_time_t']),
95 | 'fingerprint' => new EnumStub([
96 | 'md5' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'md5')), 2, ':', true)),
97 | 'sha1' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha1')), 2, ':', true)),
98 | 'sha256' => new ConstStub(wordwrap(strtoupper(openssl_x509_fingerprint($h, 'sha256')), 2, ':', true)),
99 | 'pin-sha256' => new ConstStub($pin),
100 | ]),
101 | ];
102 |
103 | return $a;
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/SplCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Stub;
15 |
16 | /**
17 | * Casts SPL related classes to array representation.
18 | *
19 | * @author Nicolas Grekas
20 | *
21 | * @final
22 | */
23 | class SplCaster
24 | {
25 | private const SPL_FILE_OBJECT_FLAGS = [
26 | \SplFileObject::DROP_NEW_LINE => 'DROP_NEW_LINE',
27 | \SplFileObject::READ_AHEAD => 'READ_AHEAD',
28 | \SplFileObject::SKIP_EMPTY => 'SKIP_EMPTY',
29 | \SplFileObject::READ_CSV => 'READ_CSV',
30 | ];
31 |
32 | public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, bool $isNested)
33 | {
34 | return self::castSplArray($c, $a, $stub, $isNested);
35 | }
36 |
37 | public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub, bool $isNested)
38 | {
39 | return self::castSplArray($c, $a, $stub, $isNested);
40 | }
41 |
42 | public static function castHeap(\Iterator $c, array $a, Stub $stub, bool $isNested)
43 | {
44 | $a += [
45 | Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c),
46 | ];
47 |
48 | return $a;
49 | }
50 |
51 | public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, bool $isNested)
52 | {
53 | $prefix = Caster::PREFIX_VIRTUAL;
54 | $mode = $c->getIteratorMode();
55 | $c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
56 |
57 | $a += [
58 | $prefix.'mode' => new ConstStub((($mode & \SplDoublyLinkedList::IT_MODE_LIFO) ? 'IT_MODE_LIFO' : 'IT_MODE_FIFO').' | '.(($mode & \SplDoublyLinkedList::IT_MODE_DELETE) ? 'IT_MODE_DELETE' : 'IT_MODE_KEEP'), $mode),
59 | $prefix.'dllist' => iterator_to_array($c),
60 | ];
61 | $c->setIteratorMode($mode);
62 |
63 | return $a;
64 | }
65 |
66 | public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool $isNested)
67 | {
68 | static $map = [
69 | 'path' => 'getPath',
70 | 'filename' => 'getFilename',
71 | 'basename' => 'getBasename',
72 | 'pathname' => 'getPathname',
73 | 'extension' => 'getExtension',
74 | 'realPath' => 'getRealPath',
75 | 'aTime' => 'getATime',
76 | 'mTime' => 'getMTime',
77 | 'cTime' => 'getCTime',
78 | 'inode' => 'getInode',
79 | 'size' => 'getSize',
80 | 'perms' => 'getPerms',
81 | 'owner' => 'getOwner',
82 | 'group' => 'getGroup',
83 | 'type' => 'getType',
84 | 'writable' => 'isWritable',
85 | 'readable' => 'isReadable',
86 | 'executable' => 'isExecutable',
87 | 'file' => 'isFile',
88 | 'dir' => 'isDir',
89 | 'link' => 'isLink',
90 | 'linkTarget' => 'getLinkTarget',
91 | ];
92 |
93 | $prefix = Caster::PREFIX_VIRTUAL;
94 | unset($a["\0SplFileInfo\0fileName"]);
95 | unset($a["\0SplFileInfo\0pathName"]);
96 |
97 | if (\PHP_VERSION_ID < 80000) {
98 | if (false === $c->getPathname()) {
99 | $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
100 |
101 | return $a;
102 | }
103 | } else {
104 | try {
105 | $c->isReadable();
106 | } catch (\RuntimeException $e) {
107 | if ('Object not initialized' !== $e->getMessage()) {
108 | throw $e;
109 | }
110 |
111 | $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
112 |
113 | return $a;
114 | } catch (\Error $e) {
115 | if ('Object not initialized' !== $e->getMessage()) {
116 | throw $e;
117 | }
118 |
119 | $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state';
120 |
121 | return $a;
122 | }
123 | }
124 |
125 | foreach ($map as $key => $accessor) {
126 | try {
127 | $a[$prefix.$key] = $c->$accessor();
128 | } catch (\Exception $e) {
129 | }
130 | }
131 |
132 | if ($a[$prefix.'realPath'] ?? false) {
133 | $a[$prefix.'realPath'] = new LinkStub($a[$prefix.'realPath']);
134 | }
135 |
136 | if (isset($a[$prefix.'perms'])) {
137 | $a[$prefix.'perms'] = new ConstStub(sprintf('0%o', $a[$prefix.'perms']), $a[$prefix.'perms']);
138 | }
139 |
140 | static $mapDate = ['aTime', 'mTime', 'cTime'];
141 | foreach ($mapDate as $key) {
142 | if (isset($a[$prefix.$key])) {
143 | $a[$prefix.$key] = new ConstStub(date('Y-m-d H:i:s', $a[$prefix.$key]), $a[$prefix.$key]);
144 | }
145 | }
146 |
147 | return $a;
148 | }
149 |
150 | public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, bool $isNested)
151 | {
152 | static $map = [
153 | 'csvControl' => 'getCsvControl',
154 | 'flags' => 'getFlags',
155 | 'maxLineLen' => 'getMaxLineLen',
156 | 'fstat' => 'fstat',
157 | 'eof' => 'eof',
158 | 'key' => 'key',
159 | ];
160 |
161 | $prefix = Caster::PREFIX_VIRTUAL;
162 |
163 | foreach ($map as $key => $accessor) {
164 | try {
165 | $a[$prefix.$key] = $c->$accessor();
166 | } catch (\Exception $e) {
167 | }
168 | }
169 |
170 | if (isset($a[$prefix.'flags'])) {
171 | $flagsArray = [];
172 | foreach (self::SPL_FILE_OBJECT_FLAGS as $value => $name) {
173 | if ($a[$prefix.'flags'] & $value) {
174 | $flagsArray[] = $name;
175 | }
176 | }
177 | $a[$prefix.'flags'] = new ConstStub(implode('|', $flagsArray), $a[$prefix.'flags']);
178 | }
179 |
180 | if (isset($a[$prefix.'fstat'])) {
181 | $a[$prefix.'fstat'] = new CutArrayStub($a[$prefix.'fstat'], ['dev', 'ino', 'nlink', 'rdev', 'blksize', 'blocks']);
182 | }
183 |
184 | return $a;
185 | }
186 |
187 | public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, bool $isNested)
188 | {
189 | $storage = [];
190 | unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
191 | unset($a["\0SplObjectStorage\0storage"]);
192 |
193 | $clone = clone $c;
194 | foreach ($clone as $obj) {
195 | $storage[] = [
196 | 'object' => $obj,
197 | 'info' => $clone->getInfo(),
198 | ];
199 | }
200 |
201 | $a += [
202 | Caster::PREFIX_VIRTUAL.'storage' => $storage,
203 | ];
204 |
205 | return $a;
206 | }
207 |
208 | public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, bool $isNested)
209 | {
210 | $a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator();
211 |
212 | return $a;
213 | }
214 |
215 | public static function castWeakReference(\WeakReference $c, array $a, Stub $stub, bool $isNested)
216 | {
217 | $a[Caster::PREFIX_VIRTUAL.'object'] = $c->get();
218 |
219 | return $a;
220 | }
221 |
222 | private static function castSplArray($c, array $a, Stub $stub, bool $isNested): array
223 | {
224 | $prefix = Caster::PREFIX_VIRTUAL;
225 | $flags = $c->getFlags();
226 |
227 | if (!($flags & \ArrayObject::STD_PROP_LIST)) {
228 | $c->setFlags(\ArrayObject::STD_PROP_LIST);
229 | $a = Caster::castObject($c, \get_class($c), method_exists($c, '__debugInfo'), $stub->class);
230 | $c->setFlags($flags);
231 | }
232 | if (\PHP_VERSION_ID < 70400) {
233 | $a[$prefix.'storage'] = $c->getArrayCopy();
234 | }
235 | $a += [
236 | $prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST),
237 | $prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS),
238 | ];
239 | if ($c instanceof \ArrayObject) {
240 | $a[$prefix.'iteratorClass'] = new ClassStub($c->getIteratorClass());
241 | }
242 |
243 | return $a;
244 | }
245 | }
246 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/StubCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Stub;
15 |
16 | /**
17 | * Casts a caster's Stub.
18 | *
19 | * @author Nicolas Grekas
20 | *
21 | * @final
22 | */
23 | class StubCaster
24 | {
25 | public static function castStub(Stub $c, array $a, Stub $stub, bool $isNested)
26 | {
27 | if ($isNested) {
28 | $stub->type = $c->type;
29 | $stub->class = $c->class;
30 | $stub->value = $c->value;
31 | $stub->handle = $c->handle;
32 | $stub->cut = $c->cut;
33 | $stub->attr = $c->attr;
34 |
35 | if (Stub::TYPE_REF === $c->type && !$c->class && \is_string($c->value) && !preg_match('//u', $c->value)) {
36 | $stub->type = Stub::TYPE_STRING;
37 | $stub->class = Stub::STRING_BINARY;
38 | }
39 |
40 | $a = [];
41 | }
42 |
43 | return $a;
44 | }
45 |
46 | public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, bool $isNested)
47 | {
48 | return $isNested ? $c->preservedSubset : $a;
49 | }
50 |
51 | public static function cutInternals($obj, array $a, Stub $stub, bool $isNested)
52 | {
53 | if ($isNested) {
54 | $stub->cut += \count($a);
55 |
56 | return [];
57 | }
58 |
59 | return $a;
60 | }
61 |
62 | public static function castEnum(EnumStub $c, array $a, Stub $stub, bool $isNested)
63 | {
64 | if ($isNested) {
65 | $stub->class = $c->dumpKeys ? '' : null;
66 | $stub->handle = 0;
67 | $stub->value = null;
68 | $stub->cut = $c->cut;
69 | $stub->attr = $c->attr;
70 |
71 | $a = [];
72 |
73 | if ($c->value) {
74 | foreach (array_keys($c->value) as $k) {
75 | $keys[] = !isset($k[0]) || "\0" !== $k[0] ? Caster::PREFIX_VIRTUAL.$k : $k;
76 | }
77 | // Preserve references with array_combine()
78 | $a = array_combine($keys, $c->value);
79 | }
80 | }
81 |
82 | return $a;
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/SymfonyCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Symfony\Component\HttpFoundation\Request;
15 | use Symfony\Component\VarDumper\Cloner\Stub;
16 |
17 | /**
18 | * @final
19 | */
20 | class SymfonyCaster
21 | {
22 | private const REQUEST_GETTERS = [
23 | 'pathInfo' => 'getPathInfo',
24 | 'requestUri' => 'getRequestUri',
25 | 'baseUrl' => 'getBaseUrl',
26 | 'basePath' => 'getBasePath',
27 | 'method' => 'getMethod',
28 | 'format' => 'getRequestFormat',
29 | ];
30 |
31 | public static function castRequest(Request $request, array $a, Stub $stub, bool $isNested)
32 | {
33 | $clone = null;
34 |
35 | foreach (self::REQUEST_GETTERS as $prop => $getter) {
36 | $key = Caster::PREFIX_PROTECTED.$prop;
37 | if (\array_key_exists($key, $a) && null === $a[$key]) {
38 | if (null === $clone) {
39 | $clone = clone $request;
40 | }
41 | $a[Caster::PREFIX_VIRTUAL.$prop] = $clone->{$getter}();
42 | }
43 | }
44 |
45 | return $a;
46 | }
47 |
48 | public static function castHttpClient($client, array $a, Stub $stub, bool $isNested)
49 | {
50 | $multiKey = sprintf("\0%s\0multi", \get_class($client));
51 | if (isset($a[$multiKey])) {
52 | $a[$multiKey] = new CutStub($a[$multiKey]);
53 | }
54 |
55 | return $a;
56 | }
57 |
58 | public static function castHttpClientResponse($response, array $a, Stub $stub, bool $isNested)
59 | {
60 | $stub->cut += \count($a);
61 | $a = [];
62 |
63 | foreach ($response->getInfo() as $k => $v) {
64 | $a[Caster::PREFIX_VIRTUAL.$k] = $v;
65 | }
66 |
67 | return $a;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/TraceStub.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Stub;
15 |
16 | /**
17 | * Represents a backtrace as returned by debug_backtrace() or Exception->getTrace().
18 | *
19 | * @author Nicolas Grekas
20 | */
21 | class TraceStub extends Stub
22 | {
23 | public $keepArgs;
24 | public $sliceOffset;
25 | public $sliceLength;
26 | public $numberingOffset;
27 |
28 | public function __construct(array $trace, bool $keepArgs = true, int $sliceOffset = 0, int $sliceLength = null, int $numberingOffset = 0)
29 | {
30 | $this->value = $trace;
31 | $this->keepArgs = $keepArgs;
32 | $this->sliceOffset = $sliceOffset;
33 | $this->sliceLength = $sliceLength;
34 | $this->numberingOffset = $numberingOffset;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Caster/UuidCaster.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Caster;
13 |
14 | use Ramsey\Uuid\UuidInterface;
15 | use Symfony\Component\VarDumper\Cloner\Stub;
16 |
17 | /**
18 | * @author Grégoire Pineau
20 | *
21 | * @final
22 | */
23 | class XmlResourceCaster
24 | {
25 | private const XML_ERRORS = [
26 | \XML_ERROR_NONE => 'XML_ERROR_NONE',
27 | \XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY',
28 | \XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX',
29 | \XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS',
30 | \XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN',
31 | \XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN',
32 | \XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR',
33 | \XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH',
34 | \XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE',
35 | \XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT',
36 | \XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF',
37 | \XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY',
38 | \XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF',
39 | \XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY',
40 | \XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF',
41 | \XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF',
42 | \XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF',
43 | \XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI',
44 | \XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING',
45 | \XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING',
46 | \XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION',
47 | \XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING',
48 | ];
49 |
50 | public static function castXml($h, array $a, Stub $stub, bool $isNested)
51 | {
52 | $a['current_byte_index'] = xml_get_current_byte_index($h);
53 | $a['current_column_number'] = xml_get_current_column_number($h);
54 | $a['current_line_number'] = xml_get_current_line_number($h);
55 | $a['error_code'] = xml_get_error_code($h);
56 |
57 | if (isset(self::XML_ERRORS[$a['error_code']])) {
58 | $a['error_code'] = new ConstStub(self::XML_ERRORS[$a['error_code']], $a['error_code']);
59 | }
60 |
61 | return $a;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Cloner/ClonerInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Cloner;
13 |
14 | /**
15 | * @author Nicolas Grekas
16 | */
17 | interface ClonerInterface
18 | {
19 | /**
20 | * Clones a PHP variable.
21 | *
22 | * @param mixed $var Any PHP variable
23 | *
24 | * @return Data The cloned variable represented by a Data object
25 | */
26 | public function cloneVar($var);
27 | }
28 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Cloner/Cursor.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Cloner;
13 |
14 | /**
15 | * Represents the current state of a dumper while dumping.
16 | *
17 | * @author Nicolas Grekas
18 | */
19 | class Cursor
20 | {
21 | public const HASH_INDEXED = Stub::ARRAY_INDEXED;
22 | public const HASH_ASSOC = Stub::ARRAY_ASSOC;
23 | public const HASH_OBJECT = Stub::TYPE_OBJECT;
24 | public const HASH_RESOURCE = Stub::TYPE_RESOURCE;
25 |
26 | public $depth = 0;
27 | public $refIndex = 0;
28 | public $softRefTo = 0;
29 | public $softRefCount = 0;
30 | public $softRefHandle = 0;
31 | public $hardRefTo = 0;
32 | public $hardRefCount = 0;
33 | public $hardRefHandle = 0;
34 | public $hashType;
35 | public $hashKey;
36 | public $hashKeyIsBinary;
37 | public $hashIndex = 0;
38 | public $hashLength = 0;
39 | public $hashCut = 0;
40 | public $stop = false;
41 | public $attr = [];
42 | public $skipChildren = false;
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Cloner/DumperInterface.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Cloner;
13 |
14 | /**
15 | * DumperInterface used by Data objects.
16 | *
17 | * @author Nicolas Grekas
18 | */
19 | interface DumperInterface
20 | {
21 | /**
22 | * Dumps a scalar value.
23 | *
24 | * @param string $type The PHP type of the value being dumped
25 | * @param string|int|float|bool $value The scalar value being dumped
26 | */
27 | public function dumpScalar(Cursor $cursor, string $type, $value);
28 |
29 | /**
30 | * Dumps a string.
31 | *
32 | * @param string $str The string being dumped
33 | * @param bool $bin Whether $str is UTF-8 or binary encoded
34 | * @param int $cut The number of characters $str has been cut by
35 | */
36 | public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut);
37 |
38 | /**
39 | * Dumps while entering an hash.
40 | *
41 | * @param int $type A Cursor::HASH_* const for the type of hash
42 | * @param string|int $class The object class, resource type or array count
43 | * @param bool $hasChild When the dump of the hash has child item
44 | */
45 | public function enterHash(Cursor $cursor, int $type, $class, bool $hasChild);
46 |
47 | /**
48 | * Dumps while leaving an hash.
49 | *
50 | * @param int $type A Cursor::HASH_* const for the type of hash
51 | * @param string|int $class The object class, resource type or array count
52 | * @param bool $hasChild When the dump of the hash has child item
53 | * @param int $cut The number of items the hash has been cut by
54 | */
55 | public function leaveHash(Cursor $cursor, int $type, $class, bool $hasChild, int $cut);
56 | }
57 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Cloner/Stub.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Cloner;
13 |
14 | /**
15 | * Represents the main properties of a PHP variable.
16 | *
17 | * @author Nicolas Grekas
18 | */
19 | class Stub
20 | {
21 | public const TYPE_REF = 1;
22 | public const TYPE_STRING = 2;
23 | public const TYPE_ARRAY = 3;
24 | public const TYPE_OBJECT = 4;
25 | public const TYPE_RESOURCE = 5;
26 |
27 | public const STRING_BINARY = 1;
28 | public const STRING_UTF8 = 2;
29 |
30 | public const ARRAY_ASSOC = 1;
31 | public const ARRAY_INDEXED = 2;
32 |
33 | public $type = self::TYPE_REF;
34 | public $class = '';
35 | public $value;
36 | public $cut = 0;
37 | public $handle = 0;
38 | public $refCount = 0;
39 | public $position = 0;
40 | public $attr = [];
41 |
42 | private static $defaultProperties = [];
43 |
44 | /**
45 | * @internal
46 | */
47 | public function __sleep(): array
48 | {
49 | $properties = [];
50 |
51 | if (!isset(self::$defaultProperties[$c = static::class])) {
52 | self::$defaultProperties[$c] = get_class_vars($c);
53 |
54 | foreach ((new \ReflectionClass($c))->getStaticProperties() as $k => $v) {
55 | unset(self::$defaultProperties[$c][$k]);
56 | }
57 | }
58 |
59 | foreach (self::$defaultProperties[$c] as $k => $v) {
60 | if ($this->$k !== $v) {
61 | $properties[] = $k;
62 | }
63 | }
64 |
65 | return $properties;
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Command/Descriptor/CliDescriptor.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Command\Descriptor;
13 |
14 | use Symfony\Component\Console\Formatter\OutputFormatterStyle;
15 | use Symfony\Component\Console\Input\ArrayInput;
16 | use Symfony\Component\Console\Output\OutputInterface;
17 | use Symfony\Component\Console\Style\SymfonyStyle;
18 | use Symfony\Component\VarDumper\Cloner\Data;
19 | use Symfony\Component\VarDumper\Dumper\CliDumper;
20 |
21 | /**
22 | * Describe collected data clones for cli output.
23 | *
24 | * @author Maxime Steinhausser
86 | $sourceDescription
87 |
21 | */
22 | abstract class AbstractDumper implements DataDumperInterface, DumperInterface
23 | {
24 | public const DUMP_LIGHT_ARRAY = 1;
25 | public const DUMP_STRING_LENGTH = 2;
26 | public const DUMP_COMMA_SEPARATOR = 4;
27 | public const DUMP_TRAILING_COMMA = 8;
28 |
29 | public static $defaultOutput = 'php://output';
30 |
31 | protected $line = '';
32 | protected $lineDumper;
33 | protected $outputStream;
34 | protected $decimalPoint; // This is locale dependent
35 | protected $indentPad = ' ';
36 | protected $flags;
37 |
38 | private $charset = '';
39 |
40 | /**
41 | * @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path, defaults to static::$defaultOutput
42 | * @param string|null $charset The default character encoding to use for non-UTF8 strings
43 | * @param int $flags A bit field of static::DUMP_* constants to fine tune dumps representation
44 | */
45 | public function __construct($output = null, string $charset = null, int $flags = 0)
46 | {
47 | $this->flags = $flags;
48 | $this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8');
49 | $this->decimalPoint = localeconv();
50 | $this->decimalPoint = $this->decimalPoint['decimal_point'];
51 | $this->setOutput($output ?: static::$defaultOutput);
52 | if (!$output && \is_string(static::$defaultOutput)) {
53 | static::$defaultOutput = $this->outputStream;
54 | }
55 | }
56 |
57 | /**
58 | * Sets the output destination of the dumps.
59 | *
60 | * @param callable|resource|string $output A line dumper callable, an opened stream or an output path
61 | *
62 | * @return callable|resource|string The previous output destination
63 | */
64 | public function setOutput($output)
65 | {
66 | $prev = $this->outputStream ?? $this->lineDumper;
67 |
68 | if (\is_callable($output)) {
69 | $this->outputStream = null;
70 | $this->lineDumper = $output;
71 | } else {
72 | if (\is_string($output)) {
73 | $output = fopen($output, 'w');
74 | }
75 | $this->outputStream = $output;
76 | $this->lineDumper = [$this, 'echoLine'];
77 | }
78 |
79 | return $prev;
80 | }
81 |
82 | /**
83 | * Sets the default character encoding to use for non-UTF8 strings.
84 | *
85 | * @return string The previous charset
86 | */
87 | public function setCharset(string $charset)
88 | {
89 | $prev = $this->charset;
90 |
91 | $charset = strtoupper($charset);
92 | $charset = null === $charset || 'UTF-8' === $charset || 'UTF8' === $charset ? 'CP1252' : $charset;
93 |
94 | $this->charset = $charset;
95 |
96 | return $prev;
97 | }
98 |
99 | /**
100 | * Sets the indentation pad string.
101 | *
102 | * @param string $pad A string that will be prepended to dumped lines, repeated by nesting level
103 | *
104 | * @return string The previous indent pad
105 | */
106 | public function setIndentPad(string $pad)
107 | {
108 | $prev = $this->indentPad;
109 | $this->indentPad = $pad;
110 |
111 | return $prev;
112 | }
113 |
114 | /**
115 | * Dumps a Data object.
116 | *
117 | * @param callable|resource|string|true|null $output A line dumper callable, an opened stream, an output path or true to return the dump
118 | *
119 | * @return string|null The dump as string when $output is true
120 | */
121 | public function dump(Data $data, $output = null)
122 | {
123 | $this->decimalPoint = localeconv();
124 | $this->decimalPoint = $this->decimalPoint['decimal_point'];
125 |
126 | if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(\LC_NUMERIC, 0) : null) {
127 | setlocale(\LC_NUMERIC, 'C');
128 | }
129 |
130 | if ($returnDump = true === $output) {
131 | $output = fopen('php://memory', 'r+');
132 | }
133 | if ($output) {
134 | $prevOutput = $this->setOutput($output);
135 | }
136 | try {
137 | $data->dump($this);
138 | $this->dumpLine(-1);
139 |
140 | if ($returnDump) {
141 | $result = stream_get_contents($output, -1, 0);
142 | fclose($output);
143 |
144 | return $result;
145 | }
146 | } finally {
147 | if ($output) {
148 | $this->setOutput($prevOutput);
149 | }
150 | if ($locale) {
151 | setlocale(\LC_NUMERIC, $locale);
152 | }
153 | }
154 |
155 | return null;
156 | }
157 |
158 | /**
159 | * Dumps the current line.
160 | *
161 | * @param int $depth The recursive depth in the dumped structure for the line being dumped,
162 | * or -1 to signal the end-of-dump to the line dumper callable
163 | */
164 | protected function dumpLine(int $depth)
165 | {
166 | ($this->lineDumper)($this->line, $depth, $this->indentPad);
167 | $this->line = '';
168 | }
169 |
170 | /**
171 | * Generic line dumper callback.
172 | */
173 | protected function echoLine(string $line, int $depth, string $indentPad)
174 | {
175 | if (-1 !== $depth) {
176 | fwrite($this->outputStream, str_repeat($indentPad, $depth).$line."\n");
177 | }
178 | }
179 |
180 | /**
181 | * Converts a non-UTF-8 string to UTF-8.
182 | *
183 | * @return string|null The string converted to UTF-8
184 | */
185 | protected function utf8Encode(?string $s)
186 | {
187 | if (null === $s || preg_match('//u', $s)) {
188 | return $s;
189 | }
190 |
191 | if (!\function_exists('iconv')) {
192 | throw new \RuntimeException('Unable to convert a non-UTF-8 string to UTF-8: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.');
193 | }
194 |
195 | if (false !== $c = @iconv($this->charset, 'UTF-8', $s)) {
196 | return $c;
197 | }
198 | if ('CP1252' !== $this->charset && false !== $c = @iconv('CP1252', 'UTF-8', $s)) {
199 | return $c;
200 | }
201 |
202 | return iconv('CP850', 'UTF-8', $s);
203 | }
204 | }
205 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Dumper/ContextProvider/CliContextProvider.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Dumper\ContextProvider;
13 |
14 | /**
15 | * Tries to provide context on CLI.
16 | *
17 | * @author Maxime Steinhausser
24 | * @author Maxime Steinhausser
20 | */
21 | interface DataDumperInterface
22 | {
23 | public function dump(Data $data);
24 | }
25 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Dumper/ServerDumper.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Dumper;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Data;
15 | use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
16 | use Symfony\Component\VarDumper\Server\Connection;
17 |
18 | /**
19 | * ServerDumper forwards serialized Data clones to a server.
20 | *
21 | * @author Maxime Steinhausser
16 | */
17 | class ThrowingCasterException extends \Exception
18 | {
19 | /**
20 | * @param \Throwable $prev The exception thrown from the caster
21 | */
22 | public function __construct(\Throwable $prev)
23 | {
24 | parent::__construct('Unexpected '.\get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014-2021 Fabien Potencier
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is furnished
8 | to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/README.md:
--------------------------------------------------------------------------------
1 | VarDumper Component
2 | ===================
3 |
4 | The VarDumper component provides mechanisms for walking through any arbitrary
5 | PHP variable. It provides a better `dump()` function that you can use instead
6 | of `var_dump`.
7 |
8 | Resources
9 | ---------
10 |
11 | * [Documentation](https://symfony.com/doc/current/components/var_dumper/introduction.html)
12 | * [Contributing](https://symfony.com/doc/current/contributing/index.html)
13 | * [Report issues](https://github.com/symfony/symfony/issues) and
14 | [send Pull Requests](https://github.com/symfony/symfony/pulls)
15 | in the [main Symfony repository](https://github.com/symfony/symfony)
16 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Resources/bin/var-dump-server:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 |
8 | *
9 | * For the full copyright and license information, please view the LICENSE
10 | * file that was distributed with this source code.
11 | */
12 |
13 | /**
14 | * Starts a dump server to collect and output dumps on a single place with multiple formats support.
15 | *
16 | * @author Maxime Steinhausser
17 | */
18 | function dump($var, ...$moreVars)
19 | {
20 | VarDumper::dump($var);
21 |
22 | foreach ($moreVars as $v) {
23 | VarDumper::dump($v);
24 | }
25 |
26 | if (1 < func_num_args()) {
27 | return func_get_args();
28 | }
29 |
30 | return $var;
31 | }
32 | }
33 |
34 | if (!function_exists('dd')) {
35 | function dd(...$vars)
36 | {
37 | foreach ($vars as $v) {
38 | VarDumper::dump($v);
39 | }
40 |
41 | exit(1);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Resources/js/htmlDescriptor.js:
--------------------------------------------------------------------------------
1 | document.addEventListener('DOMContentLoaded', function() {
2 | let prev = null;
3 | Array.from(document.getElementsByTagName('article')).reverse().forEach(function (article) {
4 | const dedupId = article.dataset.dedupId;
5 | if (dedupId === prev) {
6 | article.getElementsByTagName('header')[0].classList.add('hidden');
7 | }
8 | prev = dedupId;
9 | });
10 | });
11 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Server/Connection.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Server;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Data;
15 | use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
16 |
17 | /**
18 | * Forwards serialized Data clones to a server.
19 | *
20 | * @author Maxime Steinhausser
19 | */
20 | trait VarDumperTestTrait
21 | {
22 | /**
23 | * @internal
24 | */
25 | private $varDumperConfig = [
26 | 'casters' => [],
27 | 'flags' => null,
28 | ];
29 |
30 | protected function setUpVarDumper(array $casters, int $flags = null): void
31 | {
32 | $this->varDumperConfig['casters'] = $casters;
33 | $this->varDumperConfig['flags'] = $flags;
34 | }
35 |
36 | /**
37 | * @after
38 | */
39 | protected function tearDownVarDumper(): void
40 | {
41 | $this->varDumperConfig['casters'] = [];
42 | $this->varDumperConfig['flags'] = null;
43 | }
44 |
45 | public function assertDumpEquals($expected, $data, int $filter = 0, string $message = '')
46 | {
47 | $this->assertSame($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message);
48 | }
49 |
50 | public function assertDumpMatchesFormat($expected, $data, int $filter = 0, string $message = '')
51 | {
52 | $this->assertStringMatchesFormat($this->prepareExpectation($expected, $filter), $this->getDump($data, null, $filter), $message);
53 | }
54 |
55 | protected function getDump($data, $key = null, int $filter = 0): ?string
56 | {
57 | if (null === $flags = $this->varDumperConfig['flags']) {
58 | $flags = getenv('DUMP_LIGHT_ARRAY') ? CliDumper::DUMP_LIGHT_ARRAY : 0;
59 | $flags |= getenv('DUMP_STRING_LENGTH') ? CliDumper::DUMP_STRING_LENGTH : 0;
60 | $flags |= getenv('DUMP_COMMA_SEPARATOR') ? CliDumper::DUMP_COMMA_SEPARATOR : 0;
61 | }
62 |
63 | $cloner = new VarCloner();
64 | $cloner->addCasters($this->varDumperConfig['casters']);
65 | $cloner->setMaxItems(-1);
66 | $dumper = new CliDumper(null, null, $flags);
67 | $dumper->setColors(false);
68 | $data = $cloner->cloneVar($data, $filter)->withRefHandles(false);
69 | if (null !== $key && null === $data = $data->seek($key)) {
70 | return null;
71 | }
72 |
73 | return rtrim($dumper->dump($data, true));
74 | }
75 |
76 | private function prepareExpectation($expected, int $filter): string
77 | {
78 | if (!\is_string($expected)) {
79 | $expected = $this->getDump($expected, null, $filter);
80 | }
81 |
82 | return rtrim($expected);
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/VarDumper.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper;
13 |
14 | use Symfony\Component\HttpFoundation\Request;
15 | use Symfony\Component\HttpFoundation\RequestStack;
16 | use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
17 | use Symfony\Component\VarDumper\Caster\ReflectionCaster;
18 | use Symfony\Component\VarDumper\Cloner\VarCloner;
19 | use Symfony\Component\VarDumper\Dumper\CliDumper;
20 | use Symfony\Component\VarDumper\Dumper\ContextProvider\CliContextProvider;
21 | use Symfony\Component\VarDumper\Dumper\ContextProvider\RequestContextProvider;
22 | use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
23 | use Symfony\Component\VarDumper\Dumper\ContextualizedDumper;
24 | use Symfony\Component\VarDumper\Dumper\HtmlDumper;
25 | use Symfony\Component\VarDumper\Dumper\ServerDumper;
26 |
27 | // Load the global dump() function
28 | require_once __DIR__.'/Resources/functions/dump.php';
29 |
30 | /**
31 | * @author Nicolas Grekas
32 | */
33 | class VarDumper
34 | {
35 | private static $handler;
36 |
37 | public static function dump($var)
38 | {
39 | if (null === self::$handler) {
40 | self::register();
41 | }
42 |
43 | return (self::$handler)($var);
44 | }
45 |
46 | public static function setHandler(callable $callable = null)
47 | {
48 | $prevHandler = self::$handler;
49 |
50 | // Prevent replacing the handler with expected format as soon as the env var was set:
51 | if (isset($_SERVER['VAR_DUMPER_FORMAT'])) {
52 | return $prevHandler;
53 | }
54 |
55 | self::$handler = $callable;
56 |
57 | return $prevHandler;
58 | }
59 |
60 | private static function register(): void
61 | {
62 | $cloner = new VarCloner();
63 | $cloner->addCasters(ReflectionCaster::UNSET_CLOSURE_FILE_INFO);
64 |
65 | $format = $_SERVER['VAR_DUMPER_FORMAT'] ?? null;
66 | switch (true) {
67 | case 'html' === $format:
68 | $dumper = new HtmlDumper();
69 | break;
70 | case 'cli' === $format:
71 | $dumper = new CliDumper();
72 | break;
73 | case 'server' === $format:
74 | case $format && 'tcp' === parse_url($format, \PHP_URL_SCHEME):
75 | $host = 'server' === $format ? $_SERVER['VAR_DUMPER_SERVER'] ?? '127.0.0.1:9912' : $format;
76 | $dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? new CliDumper() : new HtmlDumper();
77 | $dumper = new ServerDumper($host, $dumper, self::getDefaultContextProviders());
78 | break;
79 | default:
80 | $dumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) ? new CliDumper() : new HtmlDumper();
81 | }
82 |
83 | if (!$dumper instanceof ServerDumper) {
84 | $dumper = new ContextualizedDumper($dumper, [new SourceContextProvider()]);
85 | }
86 |
87 | self::$handler = function ($var) use ($cloner, $dumper) {
88 | $dumper->dump($cloner->cloneVar($var));
89 | };
90 | }
91 |
92 | private static function getDefaultContextProviders(): array
93 | {
94 | $contextProviders = [];
95 |
96 | if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true) && (class_exists(Request::class))) {
97 | $requestStack = new RequestStack();
98 | $requestStack->push(Request::createFromGlobals());
99 | $contextProviders['request'] = new RequestContextProvider($requestStack);
100 | }
101 |
102 | $fileLinkFormatter = class_exists(FileLinkFormatter::class) ? new FileLinkFormatter(null, $requestStack ?? null) : null;
103 |
104 | return $contextProviders + [
105 | 'cli' => new CliContextProvider(),
106 | 'source' => new SourceContextProvider(null, null, $fileLinkFormatter),
107 | ];
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "symfony/var-dumper",
3 | "type": "library",
4 | "description": "Provides mechanisms for walking through any arbitrary PHP variable",
5 | "keywords": ["dump", "debug"],
6 | "homepage": "https://symfony.com",
7 | "license": "MIT",
8 | "authors": [
9 | {
10 | "name": "Nicolas Grekas",
11 | "email": "p@tchwork.com"
12 | },
13 | {
14 | "name": "Symfony Community",
15 | "homepage": "https://symfony.com/contributors"
16 | }
17 | ],
18 | "require": {
19 | "php": ">=7.2.5",
20 | "symfony/polyfill-mbstring": "~1.0",
21 | "symfony/polyfill-php80": "^1.16"
22 | },
23 | "require-dev": {
24 | "ext-iconv": "*",
25 | "symfony/console": "^4.4|^5.0",
26 | "symfony/process": "^4.4|^5.0",
27 | "twig/twig": "^2.13|^3.0.4"
28 | },
29 | "conflict": {
30 | "phpunit/phpunit": "<5.4.3",
31 | "symfony/console": "<4.4"
32 | },
33 | "suggest": {
34 | "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
35 | "ext-intl": "To show region name in time zone dump",
36 | "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
37 | },
38 | "autoload": {
39 | "files": [ "Resources/functions/dump.php" ],
40 | "psr-4": { "Symfony\\Component\\VarDumper\\": "" },
41 | "exclude-from-classmap": [
42 | "/Tests/"
43 | ]
44 | },
45 | "bin": [
46 | "Resources/bin/var-dump-server"
47 | ],
48 | "minimum-stability": "dev"
49 | }
50 |
--------------------------------------------------------------------------------
%s
%s', $request['method'], $uri = $request['uri'], $uri);
49 | $dedupIdentifier = $request['identifier'];
50 | } elseif (isset($context['cli'])) {
51 | $title = '$
'.$context['cli']['command_line'];
52 | $dedupIdentifier = $context['cli']['identifier'];
53 | } else {
54 | $dedupIdentifier = uniqid('', true);
55 | }
56 |
57 | $sourceDescription = '';
58 | if (isset($context['source'])) {
59 | $source = $context['source'];
60 | $projectDir = $source['project_dir'] ?? null;
61 | $sourceDescription = sprintf('%s on line %d', $source['name'], $source['line']);
62 | if (isset($source['file_link'])) {
63 | $sourceDescription = sprintf('%s', $source['file_link'], $sourceDescription);
64 | }
65 | }
66 |
67 | $isoDate = $this->extractDate($context, 'c');
68 | $tags = array_filter([
69 | 'controller' => $controller ?? null,
70 | 'project dir' => $projectDir ?? null,
71 | ]);
72 |
73 | $output->writeln(<<
75 | $title
78 |
81 | '.$this->htmlEncode($src[$i - 1]).'
'.implode("\n", $fileExcerpt).'
';
82 | }
83 | }
84 | break;
85 | }
86 | }
87 | break;
88 | }
89 | }
90 |
91 | if (false === $name) {
92 | $name = str_replace('\\', '/', $file);
93 | $name = substr($name, strrpos($name, '/') + 1);
94 | }
95 |
96 | $context = ['name' => $name, 'file' => $file, 'line' => $line];
97 | $context['file_excerpt'] = $fileExcerpt;
98 |
99 | if (null !== $this->projectDir) {
100 | $context['project_dir'] = $this->projectDir;
101 | if (str_starts_with($file, $this->projectDir)) {
102 | $context['file_relative'] = ltrim(substr($file, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
103 | }
104 | }
105 |
106 | if ($this->fileLinkFormatter && $fileLink = $this->fileLinkFormatter->format($context['file'], $context['line'])) {
107 | $context['file_link'] = $fileLink;
108 | }
109 |
110 | return $context;
111 | }
112 |
113 | private function htmlEncode(string $s): string
114 | {
115 | $html = '';
116 |
117 | $dumper = new HtmlDumper(function ($line) use (&$html) { $html .= $line; }, $this->charset);
118 | $dumper->setDumpHeader('');
119 | $dumper->setDumpBoundaries('', '');
120 |
121 | $cloner = new VarCloner();
122 | $dumper->dump($cloner->cloneVar($s));
123 |
124 | return substr(strip_tags($html), 1, -1);
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/vendor/symfony/var-dumper/Dumper/ContextualizedDumper.php:
--------------------------------------------------------------------------------
1 |
7 | *
8 | * For the full copyright and license information, please view the LICENSE
9 | * file that was distributed with this source code.
10 | */
11 |
12 | namespace Symfony\Component\VarDumper\Dumper;
13 |
14 | use Symfony\Component\VarDumper\Cloner\Data;
15 | use Symfony\Component\VarDumper\Dumper\ContextProvider\ContextProviderInterface;
16 |
17 | /**
18 | * @author Kévin Thérage