First commit
This commit is contained in:
commit
c6e2478c40
13918 changed files with 2303184 additions and 0 deletions
3
vendor/symfony/var-dumper/.gitignore
vendored
Normal file
3
vendor/symfony/var-dumper/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
composer.lock
|
||||
phpunit.xml
|
||||
vendor/
|
13
vendor/symfony/var-dumper/CHANGELOG.md
vendored
Normal file
13
vendor/symfony/var-dumper/CHANGELOG.md
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.4.0
|
||||
-----
|
||||
|
||||
* added `AbstractCloner::setMinDepth()` function to ensure minimum tree depth
|
||||
* deprecated `MongoCaster`
|
||||
|
||||
2.7.0
|
||||
-----
|
||||
|
||||
* deprecated Cloner\Data::getLimitedClone(). Use withMaxDepth, withMaxItemsPerDepth or withRefHandles instead.
|
210
vendor/symfony/var-dumper/Caster/AmqpCaster.php
vendored
Normal file
210
vendor/symfony/var-dumper/Caster/AmqpCaster.php
vendored
Normal file
|
@ -0,0 +1,210 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts Amqp related classes to array representation.
|
||||
*
|
||||
* @author Grégoire Pineau <lyrixx@lyrixx.info>
|
||||
*/
|
||||
class AmqpCaster
|
||||
{
|
||||
private static $flags = array(
|
||||
AMQP_DURABLE => 'AMQP_DURABLE',
|
||||
AMQP_PASSIVE => 'AMQP_PASSIVE',
|
||||
AMQP_EXCLUSIVE => 'AMQP_EXCLUSIVE',
|
||||
AMQP_AUTODELETE => 'AMQP_AUTODELETE',
|
||||
AMQP_INTERNAL => 'AMQP_INTERNAL',
|
||||
AMQP_NOLOCAL => 'AMQP_NOLOCAL',
|
||||
AMQP_AUTOACK => 'AMQP_AUTOACK',
|
||||
AMQP_IFEMPTY => 'AMQP_IFEMPTY',
|
||||
AMQP_IFUNUSED => 'AMQP_IFUNUSED',
|
||||
AMQP_MANDATORY => 'AMQP_MANDATORY',
|
||||
AMQP_IMMEDIATE => 'AMQP_IMMEDIATE',
|
||||
AMQP_MULTIPLE => 'AMQP_MULTIPLE',
|
||||
AMQP_NOWAIT => 'AMQP_NOWAIT',
|
||||
AMQP_REQUEUE => 'AMQP_REQUEUE',
|
||||
);
|
||||
|
||||
private static $exchangeTypes = array(
|
||||
AMQP_EX_TYPE_DIRECT => 'AMQP_EX_TYPE_DIRECT',
|
||||
AMQP_EX_TYPE_FANOUT => 'AMQP_EX_TYPE_FANOUT',
|
||||
AMQP_EX_TYPE_TOPIC => 'AMQP_EX_TYPE_TOPIC',
|
||||
AMQP_EX_TYPE_HEADERS => 'AMQP_EX_TYPE_HEADERS',
|
||||
);
|
||||
|
||||
public static function castConnection(\AMQPConnection $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
$a += array(
|
||||
$prefix.'is_connected' => $c->isConnected(),
|
||||
);
|
||||
|
||||
// Recent version of the extension already expose private properties
|
||||
if (isset($a["\x00AMQPConnection\x00login"])) {
|
||||
return $a;
|
||||
}
|
||||
|
||||
// BC layer in the amqp lib
|
||||
if (method_exists($c, 'getReadTimeout')) {
|
||||
$timeout = $c->getReadTimeout();
|
||||
} else {
|
||||
$timeout = $c->getTimeout();
|
||||
}
|
||||
|
||||
$a += array(
|
||||
$prefix.'is_connected' => $c->isConnected(),
|
||||
$prefix.'login' => $c->getLogin(),
|
||||
$prefix.'password' => $c->getPassword(),
|
||||
$prefix.'host' => $c->getHost(),
|
||||
$prefix.'vhost' => $c->getVhost(),
|
||||
$prefix.'port' => $c->getPort(),
|
||||
$prefix.'read_timeout' => $timeout,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castChannel(\AMQPChannel $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
$a += array(
|
||||
$prefix.'is_connected' => $c->isConnected(),
|
||||
$prefix.'channel_id' => $c->getChannelId(),
|
||||
);
|
||||
|
||||
// Recent version of the extension already expose private properties
|
||||
if (isset($a["\x00AMQPChannel\x00connection"])) {
|
||||
return $a;
|
||||
}
|
||||
|
||||
$a += array(
|
||||
$prefix.'connection' => $c->getConnection(),
|
||||
$prefix.'prefetch_size' => $c->getPrefetchSize(),
|
||||
$prefix.'prefetch_count' => $c->getPrefetchCount(),
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castQueue(\AMQPQueue $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
$a += array(
|
||||
$prefix.'flags' => self::extractFlags($c->getFlags()),
|
||||
);
|
||||
|
||||
// Recent version of the extension already expose private properties
|
||||
if (isset($a["\x00AMQPQueue\x00name"])) {
|
||||
return $a;
|
||||
}
|
||||
|
||||
$a += array(
|
||||
$prefix.'connection' => $c->getConnection(),
|
||||
$prefix.'channel' => $c->getChannel(),
|
||||
$prefix.'name' => $c->getName(),
|
||||
$prefix.'arguments' => $c->getArguments(),
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castExchange(\AMQPExchange $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
$a += array(
|
||||
$prefix.'flags' => self::extractFlags($c->getFlags()),
|
||||
);
|
||||
|
||||
$type = isset(self::$exchangeTypes[$c->getType()]) ? new ConstStub(self::$exchangeTypes[$c->getType()], $c->getType()) : $c->getType();
|
||||
|
||||
// Recent version of the extension already expose private properties
|
||||
if (isset($a["\x00AMQPExchange\x00name"])) {
|
||||
$a["\x00AMQPExchange\x00type"] = $type;
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
$a += array(
|
||||
$prefix.'connection' => $c->getConnection(),
|
||||
$prefix.'channel' => $c->getChannel(),
|
||||
$prefix.'name' => $c->getName(),
|
||||
$prefix.'type' => $type,
|
||||
$prefix.'arguments' => $c->getArguments(),
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castEnvelope(\AMQPEnvelope $c, array $a, Stub $stub, $isNested, $filter = 0)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
$deliveryMode = new ConstStub($c->getDeliveryMode().(2 === $c->getDeliveryMode() ? ' (persistent)' : ' (non-persistent)'), $c->getDeliveryMode());
|
||||
|
||||
// Recent version of the extension already expose private properties
|
||||
if (isset($a["\x00AMQPEnvelope\x00body"])) {
|
||||
$a["\0AMQPEnvelope\0delivery_mode"] = $deliveryMode;
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
|
||||
$a += array($prefix.'body' => $c->getBody());
|
||||
}
|
||||
|
||||
$a += array(
|
||||
$prefix.'delivery_tag' => $c->getDeliveryTag(),
|
||||
$prefix.'is_redelivery' => $c->isRedelivery(),
|
||||
$prefix.'exchange_name' => $c->getExchangeName(),
|
||||
$prefix.'routing_key' => $c->getRoutingKey(),
|
||||
$prefix.'content_type' => $c->getContentType(),
|
||||
$prefix.'content_encoding' => $c->getContentEncoding(),
|
||||
$prefix.'headers' => $c->getHeaders(),
|
||||
$prefix.'delivery_mode' => $deliveryMode,
|
||||
$prefix.'priority' => $c->getPriority(),
|
||||
$prefix.'correlation_id' => $c->getCorrelationId(),
|
||||
$prefix.'reply_to' => $c->getReplyTo(),
|
||||
$prefix.'expiration' => $c->getExpiration(),
|
||||
$prefix.'message_id' => $c->getMessageId(),
|
||||
$prefix.'timestamp' => $c->getTimeStamp(),
|
||||
$prefix.'type' => $c->getType(),
|
||||
$prefix.'user_id' => $c->getUserId(),
|
||||
$prefix.'app_id' => $c->getAppId(),
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
private static function extractFlags($flags)
|
||||
{
|
||||
$flagsArray = array();
|
||||
|
||||
foreach (self::$flags as $value => $name) {
|
||||
if ($flags & $value) {
|
||||
$flagsArray[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$flagsArray) {
|
||||
$flagsArray = array('AMQP_NOPARAM');
|
||||
}
|
||||
|
||||
return new ConstStub(implode('|', $flagsArray), $flags);
|
||||
}
|
||||
}
|
80
vendor/symfony/var-dumper/Caster/ArgsStub.php
vendored
Normal file
80
vendor/symfony/var-dumper/Caster/ArgsStub.php
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Represents a list of function arguments.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ArgsStub extends EnumStub
|
||||
{
|
||||
private static $parameters = array();
|
||||
|
||||
public function __construct(array $args, $function, $class)
|
||||
{
|
||||
list($variadic, $params) = self::getParameters($function, $class);
|
||||
|
||||
$values = array();
|
||||
foreach ($args as $k => $v) {
|
||||
$values[$k] = !is_scalar($v) && !$v instanceof Stub ? new CutStub($v) : $v;
|
||||
}
|
||||
if (null === $params) {
|
||||
parent::__construct($values, false);
|
||||
|
||||
return;
|
||||
}
|
||||
if (count($values) < count($params)) {
|
||||
$params = array_slice($params, 0, count($values));
|
||||
} elseif (count($values) > count($params)) {
|
||||
$values[] = new EnumStub(array_splice($values, count($params)), false);
|
||||
$params[] = $variadic;
|
||||
}
|
||||
if (array('...') === $params) {
|
||||
$this->dumpKeys = false;
|
||||
$this->value = $values[0]->value;
|
||||
} else {
|
||||
$this->value = array_combine($params, $values);
|
||||
}
|
||||
}
|
||||
|
||||
private static function getParameters($function, $class)
|
||||
{
|
||||
if (isset(self::$parameters[$k = $class.'::'.$function])) {
|
||||
return self::$parameters[$k];
|
||||
}
|
||||
|
||||
try {
|
||||
$r = null !== $class ? new \ReflectionMethod($class, $function) : new \ReflectionFunction($function);
|
||||
} catch (\ReflectionException $e) {
|
||||
return array(null, null);
|
||||
}
|
||||
|
||||
$variadic = '...';
|
||||
$params = array();
|
||||
foreach ($r->getParameters() as $v) {
|
||||
$k = '$'.$v->name;
|
||||
if ($v->isPassedByReference()) {
|
||||
$k = '&'.$k;
|
||||
}
|
||||
if (method_exists($v, 'isVariadic') && $v->isVariadic()) {
|
||||
$variadic .= $k;
|
||||
} else {
|
||||
$params[] = $k;
|
||||
}
|
||||
}
|
||||
|
||||
return self::$parameters[$k] = array($variadic, $params);
|
||||
}
|
||||
}
|
162
vendor/symfony/var-dumper/Caster/Caster.php
vendored
Normal file
162
vendor/symfony/var-dumper/Caster/Caster.php
vendored
Normal file
|
@ -0,0 +1,162 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Helper for filtering out properties in casters.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
class Caster
|
||||
{
|
||||
const EXCLUDE_VERBOSE = 1;
|
||||
const EXCLUDE_VIRTUAL = 2;
|
||||
const EXCLUDE_DYNAMIC = 4;
|
||||
const EXCLUDE_PUBLIC = 8;
|
||||
const EXCLUDE_PROTECTED = 16;
|
||||
const EXCLUDE_PRIVATE = 32;
|
||||
const EXCLUDE_NULL = 64;
|
||||
const EXCLUDE_EMPTY = 128;
|
||||
const EXCLUDE_NOT_IMPORTANT = 256;
|
||||
const EXCLUDE_STRICT = 512;
|
||||
|
||||
const PREFIX_VIRTUAL = "\0~\0";
|
||||
const PREFIX_DYNAMIC = "\0+\0";
|
||||
const PREFIX_PROTECTED = "\0*\0";
|
||||
|
||||
/**
|
||||
* Casts objects to arrays and adds the dynamic property prefix.
|
||||
*
|
||||
* @param object $obj The object to cast
|
||||
* @param string $class The class of the object
|
||||
* @param bool $hasDebugInfo Whether the __debugInfo method exists on $obj or not
|
||||
*
|
||||
* @return array The array-cast of the object, with prefixed dynamic properties
|
||||
*/
|
||||
public static function castObject($obj, $class, $hasDebugInfo = false)
|
||||
{
|
||||
if ($class instanceof \ReflectionClass) {
|
||||
@trigger_error(sprintf('Passing a ReflectionClass to %s() is deprecated since Symfony 3.3 and will be unsupported in 4.0. Pass the class name as string instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
$hasDebugInfo = $class->hasMethod('__debugInfo');
|
||||
$class = $class->name;
|
||||
}
|
||||
if ($hasDebugInfo) {
|
||||
$a = $obj->__debugInfo();
|
||||
} elseif ($obj instanceof \Closure) {
|
||||
$a = array();
|
||||
} else {
|
||||
$a = (array) $obj;
|
||||
}
|
||||
if ($obj instanceof \__PHP_Incomplete_Class) {
|
||||
return $a;
|
||||
}
|
||||
|
||||
if ($a) {
|
||||
static $publicProperties = array();
|
||||
|
||||
$i = 0;
|
||||
$prefixedKeys = array();
|
||||
foreach ($a as $k => $v) {
|
||||
if (isset($k[0]) ? "\0" !== $k[0] : \PHP_VERSION_ID >= 70200) {
|
||||
if (!isset($publicProperties[$class])) {
|
||||
foreach (get_class_vars($class) as $prop => $v) {
|
||||
$publicProperties[$class][$prop] = true;
|
||||
}
|
||||
}
|
||||
if (!isset($publicProperties[$class][$k])) {
|
||||
$prefixedKeys[$i] = self::PREFIX_DYNAMIC.$k;
|
||||
}
|
||||
} elseif (isset($k[16]) && "\0" === $k[16] && 0 === strpos($k, "\0class@anonymous\0")) {
|
||||
$prefixedKeys[$i] = "\0".get_parent_class($class).'@anonymous'.strrchr($k, "\0");
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
if ($prefixedKeys) {
|
||||
$keys = array_keys($a);
|
||||
foreach ($prefixedKeys as $i => $k) {
|
||||
$keys[$i] = $k;
|
||||
}
|
||||
$a = array_combine($keys, $a);
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters out the specified properties.
|
||||
*
|
||||
* By default, a single match in the $filter bit field filters properties out, following an "or" logic.
|
||||
* When EXCLUDE_STRICT is set, an "and" logic is applied: all bits must match for a property to be removed.
|
||||
*
|
||||
* @param array $a The array containing the properties to filter
|
||||
* @param int $filter A bit field of Caster::EXCLUDE_* constants specifying which properties to filter out
|
||||
* @param string[] $listedProperties List of properties to exclude when Caster::EXCLUDE_VERBOSE is set, and to preserve when Caster::EXCLUDE_NOT_IMPORTANT is set
|
||||
* @param int &$count Set to the number of removed properties
|
||||
*
|
||||
* @return array The filtered array
|
||||
*/
|
||||
public static function filter(array $a, $filter, array $listedProperties = array(), &$count = 0)
|
||||
{
|
||||
$count = 0;
|
||||
|
||||
foreach ($a as $k => $v) {
|
||||
$type = self::EXCLUDE_STRICT & $filter;
|
||||
|
||||
if (null === $v) {
|
||||
$type |= self::EXCLUDE_NULL & $filter;
|
||||
$type |= self::EXCLUDE_EMPTY & $filter;
|
||||
} elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || array() === $v) {
|
||||
$type |= self::EXCLUDE_EMPTY & $filter;
|
||||
}
|
||||
if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !in_array($k, $listedProperties, true)) {
|
||||
$type |= self::EXCLUDE_NOT_IMPORTANT;
|
||||
}
|
||||
if ((self::EXCLUDE_VERBOSE & $filter) && in_array($k, $listedProperties, true)) {
|
||||
$type |= self::EXCLUDE_VERBOSE;
|
||||
}
|
||||
|
||||
if (!isset($k[1]) || "\0" !== $k[0]) {
|
||||
$type |= self::EXCLUDE_PUBLIC & $filter;
|
||||
} elseif ('~' === $k[1]) {
|
||||
$type |= self::EXCLUDE_VIRTUAL & $filter;
|
||||
} elseif ('+' === $k[1]) {
|
||||
$type |= self::EXCLUDE_DYNAMIC & $filter;
|
||||
} elseif ('*' === $k[1]) {
|
||||
$type |= self::EXCLUDE_PROTECTED & $filter;
|
||||
} else {
|
||||
$type |= self::EXCLUDE_PRIVATE & $filter;
|
||||
}
|
||||
|
||||
if ((self::EXCLUDE_STRICT & $filter) ? $type === $filter : $type) {
|
||||
unset($a[$k]);
|
||||
++$count;
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
if (isset($a['__PHP_Incomplete_Class_Name'])) {
|
||||
$stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')';
|
||||
unset($a['__PHP_Incomplete_Class_Name']);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
87
vendor/symfony/var-dumper/Caster/ClassStub.php
vendored
Normal file
87
vendor/symfony/var-dumper/Caster/ClassStub.php
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
/**
|
||||
* Represents a PHP class identifier.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ClassStub extends ConstStub
|
||||
{
|
||||
/**
|
||||
* @param string A PHP identifier, e.g. a class, method, interface, etc. name
|
||||
* @param callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier
|
||||
*/
|
||||
public function __construct($identifier, $callable = null)
|
||||
{
|
||||
$this->value = $identifier;
|
||||
|
||||
if (0 < $i = strrpos($identifier, '\\')) {
|
||||
$this->attr['ellipsis'] = strlen($identifier) - $i;
|
||||
$this->attr['ellipsis-type'] = 'class';
|
||||
$this->attr['ellipsis-tail'] = 1;
|
||||
}
|
||||
|
||||
try {
|
||||
if (null !== $callable) {
|
||||
if ($callable instanceof \Closure) {
|
||||
$r = new \ReflectionFunction($callable);
|
||||
} elseif (is_object($callable)) {
|
||||
$r = array($callable, '__invoke');
|
||||
} elseif (is_array($callable)) {
|
||||
$r = $callable;
|
||||
} elseif (false !== $i = strpos($callable, '::')) {
|
||||
$r = array(substr($callable, 0, $i), substr($callable, 2 + $i));
|
||||
} else {
|
||||
$r = new \ReflectionFunction($callable);
|
||||
}
|
||||
} elseif (0 < $i = strpos($identifier, '::') ?: strpos($identifier, '->')) {
|
||||
$r = array(substr($identifier, 0, $i), substr($identifier, 2 + $i));
|
||||
} else {
|
||||
$r = new \ReflectionClass($identifier);
|
||||
}
|
||||
|
||||
if (is_array($r)) {
|
||||
try {
|
||||
$r = new \ReflectionMethod($r[0], $r[1]);
|
||||
} catch (\ReflectionException $e) {
|
||||
$r = new \ReflectionClass($r[0]);
|
||||
}
|
||||
}
|
||||
} catch (\ReflectionException $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($f = $r->getFileName()) {
|
||||
$this->attr['file'] = $f;
|
||||
$this->attr['line'] = $r->getStartLine();
|
||||
}
|
||||
}
|
||||
|
||||
public static function wrapCallable($callable)
|
||||
{
|
||||
if (is_object($callable) || !is_callable($callable)) {
|
||||
return $callable;
|
||||
}
|
||||
|
||||
if (!is_array($callable)) {
|
||||
$callable = new static($callable);
|
||||
} elseif (is_string($callable[0])) {
|
||||
$callable[0] = new static($callable[0]);
|
||||
} else {
|
||||
$callable[1] = new static($callable[1], $callable);
|
||||
}
|
||||
|
||||
return $callable;
|
||||
}
|
||||
}
|
33
vendor/symfony/var-dumper/Caster/ConstStub.php
vendored
Normal file
33
vendor/symfony/var-dumper/Caster/ConstStub.php
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Represents a PHP constant and its value.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ConstStub extends Stub
|
||||
{
|
||||
public function __construct($name, $value)
|
||||
{
|
||||
$this->class = $name;
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return (string) $this->value;
|
||||
}
|
||||
}
|
30
vendor/symfony/var-dumper/Caster/CutArrayStub.php
vendored
Normal file
30
vendor/symfony/var-dumper/Caster/CutArrayStub.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
/**
|
||||
* Represents a cut array.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class CutArrayStub extends CutStub
|
||||
{
|
||||
public $preservedSubset;
|
||||
|
||||
public function __construct(array $value, array $preservedKeys)
|
||||
{
|
||||
parent::__construct($value);
|
||||
|
||||
$this->preservedSubset = array_intersect_key($value, array_flip($preservedKeys));
|
||||
$this->cut -= count($this->preservedSubset);
|
||||
}
|
||||
}
|
59
vendor/symfony/var-dumper/Caster/CutStub.php
vendored
Normal file
59
vendor/symfony/var-dumper/Caster/CutStub.php
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Represents the main properties of a PHP variable, pre-casted by a caster.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class CutStub extends Stub
|
||||
{
|
||||
public function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
|
||||
switch (gettype($value)) {
|
||||
case 'object':
|
||||
$this->type = self::TYPE_OBJECT;
|
||||
$this->class = get_class($value);
|
||||
$this->cut = -1;
|
||||
break;
|
||||
|
||||
case 'array':
|
||||
$this->type = self::TYPE_ARRAY;
|
||||
$this->class = self::ARRAY_ASSOC;
|
||||
$this->cut = $this->value = count($value);
|
||||
break;
|
||||
|
||||
case 'resource':
|
||||
case 'unknown type':
|
||||
case 'resource (closed)':
|
||||
$this->type = self::TYPE_RESOURCE;
|
||||
$this->handle = (int) $value;
|
||||
if ('Unknown' === $this->class = @get_resource_type($value)) {
|
||||
$this->class = 'Closed';
|
||||
}
|
||||
$this->cut = -1;
|
||||
break;
|
||||
|
||||
case 'string':
|
||||
$this->type = self::TYPE_STRING;
|
||||
$this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY;
|
||||
$this->cut = self::STRING_BINARY === $this->class ? strlen($value) : mb_strlen($value, 'UTF-8');
|
||||
$this->value = '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
302
vendor/symfony/var-dumper/Caster/DOMCaster.php
vendored
Normal file
302
vendor/symfony/var-dumper/Caster/DOMCaster.php
vendored
Normal file
|
@ -0,0 +1,302 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts DOM related classes to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class DOMCaster
|
||||
{
|
||||
private static $errorCodes = array(
|
||||
DOM_PHP_ERR => 'DOM_PHP_ERR',
|
||||
DOM_INDEX_SIZE_ERR => 'DOM_INDEX_SIZE_ERR',
|
||||
DOMSTRING_SIZE_ERR => 'DOMSTRING_SIZE_ERR',
|
||||
DOM_HIERARCHY_REQUEST_ERR => 'DOM_HIERARCHY_REQUEST_ERR',
|
||||
DOM_WRONG_DOCUMENT_ERR => 'DOM_WRONG_DOCUMENT_ERR',
|
||||
DOM_INVALID_CHARACTER_ERR => 'DOM_INVALID_CHARACTER_ERR',
|
||||
DOM_NO_DATA_ALLOWED_ERR => 'DOM_NO_DATA_ALLOWED_ERR',
|
||||
DOM_NO_MODIFICATION_ALLOWED_ERR => 'DOM_NO_MODIFICATION_ALLOWED_ERR',
|
||||
DOM_NOT_FOUND_ERR => 'DOM_NOT_FOUND_ERR',
|
||||
DOM_NOT_SUPPORTED_ERR => 'DOM_NOT_SUPPORTED_ERR',
|
||||
DOM_INUSE_ATTRIBUTE_ERR => 'DOM_INUSE_ATTRIBUTE_ERR',
|
||||
DOM_INVALID_STATE_ERR => 'DOM_INVALID_STATE_ERR',
|
||||
DOM_SYNTAX_ERR => 'DOM_SYNTAX_ERR',
|
||||
DOM_INVALID_MODIFICATION_ERR => 'DOM_INVALID_MODIFICATION_ERR',
|
||||
DOM_NAMESPACE_ERR => 'DOM_NAMESPACE_ERR',
|
||||
DOM_INVALID_ACCESS_ERR => 'DOM_INVALID_ACCESS_ERR',
|
||||
DOM_VALIDATION_ERR => 'DOM_VALIDATION_ERR',
|
||||
);
|
||||
|
||||
private static $nodeTypes = array(
|
||||
XML_ELEMENT_NODE => 'XML_ELEMENT_NODE',
|
||||
XML_ATTRIBUTE_NODE => 'XML_ATTRIBUTE_NODE',
|
||||
XML_TEXT_NODE => 'XML_TEXT_NODE',
|
||||
XML_CDATA_SECTION_NODE => 'XML_CDATA_SECTION_NODE',
|
||||
XML_ENTITY_REF_NODE => 'XML_ENTITY_REF_NODE',
|
||||
XML_ENTITY_NODE => 'XML_ENTITY_NODE',
|
||||
XML_PI_NODE => 'XML_PI_NODE',
|
||||
XML_COMMENT_NODE => 'XML_COMMENT_NODE',
|
||||
XML_DOCUMENT_NODE => 'XML_DOCUMENT_NODE',
|
||||
XML_DOCUMENT_TYPE_NODE => 'XML_DOCUMENT_TYPE_NODE',
|
||||
XML_DOCUMENT_FRAG_NODE => 'XML_DOCUMENT_FRAG_NODE',
|
||||
XML_NOTATION_NODE => 'XML_NOTATION_NODE',
|
||||
XML_HTML_DOCUMENT_NODE => 'XML_HTML_DOCUMENT_NODE',
|
||||
XML_DTD_NODE => 'XML_DTD_NODE',
|
||||
XML_ELEMENT_DECL_NODE => 'XML_ELEMENT_DECL_NODE',
|
||||
XML_ATTRIBUTE_DECL_NODE => 'XML_ATTRIBUTE_DECL_NODE',
|
||||
XML_ENTITY_DECL_NODE => 'XML_ENTITY_DECL_NODE',
|
||||
XML_NAMESPACE_DECL_NODE => 'XML_NAMESPACE_DECL_NODE',
|
||||
);
|
||||
|
||||
public static function castException(\DOMException $e, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$k = Caster::PREFIX_PROTECTED.'code';
|
||||
if (isset($a[$k], self::$errorCodes[$a[$k]])) {
|
||||
$a[$k] = new ConstStub(self::$errorCodes[$a[$k]], $a[$k]);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castLength($dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'length' => $dom->length,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castImplementation($dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
Caster::PREFIX_VIRTUAL.'Core' => '1.0',
|
||||
Caster::PREFIX_VIRTUAL.'XML' => '2.0',
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castNode(\DOMNode $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'nodeName' => $dom->nodeName,
|
||||
'nodeValue' => new CutStub($dom->nodeValue),
|
||||
'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
|
||||
'parentNode' => new CutStub($dom->parentNode),
|
||||
'childNodes' => $dom->childNodes,
|
||||
'firstChild' => new CutStub($dom->firstChild),
|
||||
'lastChild' => new CutStub($dom->lastChild),
|
||||
'previousSibling' => new CutStub($dom->previousSibling),
|
||||
'nextSibling' => new CutStub($dom->nextSibling),
|
||||
'attributes' => $dom->attributes,
|
||||
'ownerDocument' => new CutStub($dom->ownerDocument),
|
||||
'namespaceURI' => $dom->namespaceURI,
|
||||
'prefix' => $dom->prefix,
|
||||
'localName' => $dom->localName,
|
||||
'baseURI' => $dom->baseURI ? new LinkStub($dom->baseURI) : $dom->baseURI,
|
||||
'textContent' => new CutStub($dom->textContent),
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castNameSpaceNode(\DOMNameSpaceNode $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'nodeName' => $dom->nodeName,
|
||||
'nodeValue' => new CutStub($dom->nodeValue),
|
||||
'nodeType' => new ConstStub(self::$nodeTypes[$dom->nodeType], $dom->nodeType),
|
||||
'prefix' => $dom->prefix,
|
||||
'localName' => $dom->localName,
|
||||
'namespaceURI' => $dom->namespaceURI,
|
||||
'ownerDocument' => new CutStub($dom->ownerDocument),
|
||||
'parentNode' => new CutStub($dom->parentNode),
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castDocument(\DOMDocument $dom, array $a, Stub $stub, $isNested, $filter = 0)
|
||||
{
|
||||
$a += array(
|
||||
'doctype' => $dom->doctype,
|
||||
'implementation' => $dom->implementation,
|
||||
'documentElement' => new CutStub($dom->documentElement),
|
||||
'actualEncoding' => $dom->actualEncoding,
|
||||
'encoding' => $dom->encoding,
|
||||
'xmlEncoding' => $dom->xmlEncoding,
|
||||
'standalone' => $dom->standalone,
|
||||
'xmlStandalone' => $dom->xmlStandalone,
|
||||
'version' => $dom->version,
|
||||
'xmlVersion' => $dom->xmlVersion,
|
||||
'strictErrorChecking' => $dom->strictErrorChecking,
|
||||
'documentURI' => $dom->documentURI ? new LinkStub($dom->documentURI) : $dom->documentURI,
|
||||
'config' => $dom->config,
|
||||
'formatOutput' => $dom->formatOutput,
|
||||
'validateOnParse' => $dom->validateOnParse,
|
||||
'resolveExternals' => $dom->resolveExternals,
|
||||
'preserveWhiteSpace' => $dom->preserveWhiteSpace,
|
||||
'recover' => $dom->recover,
|
||||
'substituteEntities' => $dom->substituteEntities,
|
||||
);
|
||||
|
||||
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
|
||||
$formatOutput = $dom->formatOutput;
|
||||
$dom->formatOutput = true;
|
||||
$a += array(Caster::PREFIX_VIRTUAL.'xml' => $dom->saveXML());
|
||||
$dom->formatOutput = $formatOutput;
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castCharacterData(\DOMCharacterData $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'data' => $dom->data,
|
||||
'length' => $dom->length,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castAttr(\DOMAttr $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'name' => $dom->name,
|
||||
'specified' => $dom->specified,
|
||||
'value' => $dom->value,
|
||||
'ownerElement' => $dom->ownerElement,
|
||||
'schemaTypeInfo' => $dom->schemaTypeInfo,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castElement(\DOMElement $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'tagName' => $dom->tagName,
|
||||
'schemaTypeInfo' => $dom->schemaTypeInfo,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castText(\DOMText $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'wholeText' => $dom->wholeText,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castTypeinfo(\DOMTypeinfo $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'typeName' => $dom->typeName,
|
||||
'typeNamespace' => $dom->typeNamespace,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castDomError(\DOMDomError $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'severity' => $dom->severity,
|
||||
'message' => $dom->message,
|
||||
'type' => $dom->type,
|
||||
'relatedException' => $dom->relatedException,
|
||||
'related_data' => $dom->related_data,
|
||||
'location' => $dom->location,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castLocator(\DOMLocator $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'lineNumber' => $dom->lineNumber,
|
||||
'columnNumber' => $dom->columnNumber,
|
||||
'offset' => $dom->offset,
|
||||
'relatedNode' => $dom->relatedNode,
|
||||
'uri' => $dom->uri ? new LinkStub($dom->uri, $dom->lineNumber) : $dom->uri,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castDocumentType(\DOMDocumentType $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'name' => $dom->name,
|
||||
'entities' => $dom->entities,
|
||||
'notations' => $dom->notations,
|
||||
'publicId' => $dom->publicId,
|
||||
'systemId' => $dom->systemId,
|
||||
'internalSubset' => $dom->internalSubset,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castNotation(\DOMNotation $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'publicId' => $dom->publicId,
|
||||
'systemId' => $dom->systemId,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castEntity(\DOMEntity $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'publicId' => $dom->publicId,
|
||||
'systemId' => $dom->systemId,
|
||||
'notationName' => $dom->notationName,
|
||||
'actualEncoding' => $dom->actualEncoding,
|
||||
'encoding' => $dom->encoding,
|
||||
'version' => $dom->version,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castProcessingInstruction(\DOMProcessingInstruction $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'target' => $dom->target,
|
||||
'data' => $dom->data,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castXPath(\DOMXPath $dom, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
'document' => $dom->document,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
129
vendor/symfony/var-dumper/Caster/DateCaster.php
vendored
Normal file
129
vendor/symfony/var-dumper/Caster/DateCaster.php
vendored
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts DateTimeInterface related classes to array representation.
|
||||
*
|
||||
* @author Dany Maillard <danymaillard93b@gmail.com>
|
||||
*/
|
||||
class DateCaster
|
||||
{
|
||||
public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, $isNested, $filter)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
$location = $d->getTimezone()->getLocation();
|
||||
$fromNow = (new \DateTime())->diff($d);
|
||||
|
||||
$title = $d->format('l, F j, Y')
|
||||
."\n".self::formatInterval($fromNow).' from now'
|
||||
.($location ? ($d->format('I') ? "\nDST On" : "\nDST Off") : '')
|
||||
;
|
||||
|
||||
$a = array();
|
||||
$a[$prefix.'date'] = new ConstStub(self::formatDateTime($d, $location ? ' e (P)' : ' P'), $title);
|
||||
|
||||
$stub->class .= $d->format(' @U');
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castInterval(\DateInterval $interval, array $a, Stub $stub, $isNested, $filter)
|
||||
{
|
||||
$now = new \DateTimeImmutable();
|
||||
$numberOfSeconds = $now->add($interval)->getTimestamp() - $now->getTimestamp();
|
||||
$title = number_format($numberOfSeconds, 0, '.', ' ').'s';
|
||||
|
||||
$i = array(Caster::PREFIX_VIRTUAL.'interval' => new ConstStub(self::formatInterval($interval), $title));
|
||||
|
||||
return $filter & Caster::EXCLUDE_VERBOSE ? $i : $i + $a;
|
||||
}
|
||||
|
||||
private static function formatInterval(\DateInterval $i)
|
||||
{
|
||||
$format = '%R ';
|
||||
|
||||
if (0 === $i->y && 0 === $i->m && ($i->h >= 24 || $i->i >= 60 || $i->s >= 60)) {
|
||||
$i = date_diff($d = new \DateTime(), date_add(clone $d, $i)); // recalculate carry over points
|
||||
$format .= 0 < $i->days ? '%ad ' : '';
|
||||
} else {
|
||||
$format .= ($i->y ? '%yy ' : '').($i->m ? '%mm ' : '').($i->d ? '%dd ' : '');
|
||||
}
|
||||
|
||||
if (\PHP_VERSION_ID >= 70100 && isset($i->f)) {
|
||||
$format .= $i->h || $i->i || $i->s || $i->f ? '%H:%I:'.self::formatSeconds($i->s, substr($i->f, 2)) : '';
|
||||
} else {
|
||||
$format .= $i->h || $i->i || $i->s ? '%H:%I:%S' : '';
|
||||
}
|
||||
|
||||
$format = '%R ' === $format ? '0s' : $format;
|
||||
|
||||
return $i->format(rtrim($format));
|
||||
}
|
||||
|
||||
public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, $isNested, $filter)
|
||||
{
|
||||
$location = $timeZone->getLocation();
|
||||
$formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P');
|
||||
$title = $location && extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code'], \Locale::getDefault()) : '';
|
||||
|
||||
$z = array(Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title));
|
||||
|
||||
return $filter & Caster::EXCLUDE_VERBOSE ? $z : $z + $a;
|
||||
}
|
||||
|
||||
public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, $isNested, $filter)
|
||||
{
|
||||
if (defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) { // see https://bugs.php.net/bug.php?id=71635
|
||||
return $a;
|
||||
}
|
||||
|
||||
$dates = array();
|
||||
if (\PHP_VERSION_ID >= 70107) { // see https://bugs.php.net/bug.php?id=74639
|
||||
foreach (clone $p as $i => $d) {
|
||||
if (3 === $i) {
|
||||
$now = new \DateTimeImmutable();
|
||||
$dates[] = sprintf('%s more', ($end = $p->getEndDate())
|
||||
? ceil(($end->format('U.u') - $d->format('U.u')) / ($now->add($p->getDateInterval())->format('U.u') - $now->format('U.u')))
|
||||
: $p->recurrences - $i
|
||||
);
|
||||
break;
|
||||
}
|
||||
$dates[] = sprintf('%s) %s', $i + 1, self::formatDateTime($d));
|
||||
}
|
||||
}
|
||||
|
||||
$period = sprintf(
|
||||
'every %s, from %s (%s) %s',
|
||||
self::formatInterval($p->getDateInterval()),
|
||||
self::formatDateTime($p->getStartDate()),
|
||||
$p->include_start_date ? 'included' : 'excluded',
|
||||
($end = $p->getEndDate()) ? 'to '.self::formatDateTime($end) : 'recurring '.$p->recurrences.' time/s'
|
||||
);
|
||||
|
||||
$p = array(Caster::PREFIX_VIRTUAL.'period' => new ConstStub($period, implode("\n", $dates)));
|
||||
|
||||
return $filter & Caster::EXCLUDE_VERBOSE ? $p : $p + $a;
|
||||
}
|
||||
|
||||
private static function formatDateTime(\DateTimeInterface $d, $extra = '')
|
||||
{
|
||||
return $d->format('Y-m-d H:i:'.self::formatSeconds($d->format('s'), $d->format('u')).$extra);
|
||||
}
|
||||
|
||||
private static function formatSeconds($s, $us)
|
||||
{
|
||||
return sprintf('%02d.%s', $s, 0 === ($len = strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us));
|
||||
}
|
||||
}
|
60
vendor/symfony/var-dumper/Caster/DoctrineCaster.php
vendored
Normal file
60
vendor/symfony/var-dumper/Caster/DoctrineCaster.php
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Doctrine\Common\Proxy\Proxy as CommonProxy;
|
||||
use Doctrine\ORM\Proxy\Proxy as OrmProxy;
|
||||
use Doctrine\ORM\PersistentCollection;
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts Doctrine related classes to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class DoctrineCaster
|
||||
{
|
||||
public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
foreach (array('__cloner__', '__initializer__') as $k) {
|
||||
if (array_key_exists($k, $a)) {
|
||||
unset($a[$k]);
|
||||
++$stub->cut;
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
foreach (array('_entityPersister', '_identifier') as $k) {
|
||||
if (array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) {
|
||||
unset($a[$k]);
|
||||
++$stub->cut;
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
foreach (array('snapshot', 'association', 'typeClass') as $k) {
|
||||
if (array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) {
|
||||
$a[$k] = new CutStub($a[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
30
vendor/symfony/var-dumper/Caster/EnumStub.php
vendored
Normal file
30
vendor/symfony/var-dumper/Caster/EnumStub.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Represents an enumeration of values.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class EnumStub extends Stub
|
||||
{
|
||||
public $dumpKeys = true;
|
||||
|
||||
public function __construct(array $values, $dumpKeys = true)
|
||||
{
|
||||
$this->value = $values;
|
||||
$this->dumpKeys = $dumpKeys;
|
||||
}
|
||||
}
|
349
vendor/symfony/var-dumper/Caster/ExceptionCaster.php
vendored
Normal file
349
vendor/symfony/var-dumper/Caster/ExceptionCaster.php
vendored
Normal file
|
@ -0,0 +1,349 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\Debug\Exception\SilencedErrorContext;
|
||||
use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts common Exception classes to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ExceptionCaster
|
||||
{
|
||||
public static $srcContext = 1;
|
||||
public static $traceArgs = true;
|
||||
public static $errorTypes = array(
|
||||
E_DEPRECATED => 'E_DEPRECATED',
|
||||
E_USER_DEPRECATED => 'E_USER_DEPRECATED',
|
||||
E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR',
|
||||
E_ERROR => 'E_ERROR',
|
||||
E_WARNING => 'E_WARNING',
|
||||
E_PARSE => 'E_PARSE',
|
||||
E_NOTICE => 'E_NOTICE',
|
||||
E_CORE_ERROR => 'E_CORE_ERROR',
|
||||
E_CORE_WARNING => 'E_CORE_WARNING',
|
||||
E_COMPILE_ERROR => 'E_COMPILE_ERROR',
|
||||
E_COMPILE_WARNING => 'E_COMPILE_WARNING',
|
||||
E_USER_ERROR => 'E_USER_ERROR',
|
||||
E_USER_WARNING => 'E_USER_WARNING',
|
||||
E_USER_NOTICE => 'E_USER_NOTICE',
|
||||
E_STRICT => 'E_STRICT',
|
||||
);
|
||||
|
||||
private static $framesCache = array();
|
||||
|
||||
public static function castError(\Error $e, array $a, Stub $stub, $isNested, $filter = 0)
|
||||
{
|
||||
return self::filterExceptionArray($stub->class, $a, "\0Error\0", $filter);
|
||||
}
|
||||
|
||||
public static function castException(\Exception $e, array $a, Stub $stub, $isNested, $filter = 0)
|
||||
{
|
||||
return self::filterExceptionArray($stub->class, $a, "\0Exception\0", $filter);
|
||||
}
|
||||
|
||||
public static function castErrorException(\ErrorException $e, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
if (isset($a[$s = Caster::PREFIX_PROTECTED.'severity'], self::$errorTypes[$a[$s]])) {
|
||||
$a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castThrowingCasterException(ThrowingCasterException $e, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$trace = Caster::PREFIX_VIRTUAL.'trace';
|
||||
$prefix = Caster::PREFIX_PROTECTED;
|
||||
$xPrefix = "\0Exception\0";
|
||||
|
||||
if (isset($a[$xPrefix.'previous'], $a[$trace]) && $a[$xPrefix.'previous'] instanceof \Exception) {
|
||||
$b = (array) $a[$xPrefix.'previous'];
|
||||
self::traceUnshift($b[$xPrefix.'trace'], get_class($a[$xPrefix.'previous']), $b[$prefix.'file'], $b[$prefix.'line']);
|
||||
$a[$trace] = new TraceStub($b[$xPrefix.'trace'], false, 0, -count($a[$trace]->value));
|
||||
}
|
||||
|
||||
unset($a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castSilencedErrorContext(SilencedErrorContext $e, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$sPrefix = "\0".SilencedErrorContext::class."\0";
|
||||
|
||||
if (!isset($a[$s = $sPrefix.'severity'])) {
|
||||
return $a;
|
||||
}
|
||||
|
||||
if (isset(self::$errorTypes[$a[$s]])) {
|
||||
$a[$s] = new ConstStub(self::$errorTypes[$a[$s]], $a[$s]);
|
||||
}
|
||||
|
||||
$trace = array(array(
|
||||
'file' => $a[$sPrefix.'file'],
|
||||
'line' => $a[$sPrefix.'line'],
|
||||
));
|
||||
|
||||
if (isset($a[$sPrefix.'trace'])) {
|
||||
$trace = array_merge($trace, $a[$sPrefix.'trace']);
|
||||
}
|
||||
|
||||
unset($a[$sPrefix.'file'], $a[$sPrefix.'line'], $a[$sPrefix.'trace']);
|
||||
$a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
if (!$isNested) {
|
||||
return $a;
|
||||
}
|
||||
$stub->class = '';
|
||||
$stub->handle = 0;
|
||||
$frames = $trace->value;
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
$a = array();
|
||||
$j = count($frames);
|
||||
if (0 > $i = $trace->sliceOffset) {
|
||||
$i = max(0, $j + $i);
|
||||
}
|
||||
if (!isset($trace->value[$i])) {
|
||||
return array();
|
||||
}
|
||||
$lastCall = isset($frames[$i]['function']) ? (isset($frames[$i]['class']) ? $frames[0]['class'].$frames[$i]['type'] : '').$frames[$i]['function'].'()' : '';
|
||||
$frames[] = array('function' => '');
|
||||
$collapse = false;
|
||||
|
||||
for ($j += $trace->numberingOffset - $i++; isset($frames[$i]); ++$i, --$j) {
|
||||
$f = $frames[$i];
|
||||
$call = isset($f['function']) ? (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'] : '???';
|
||||
|
||||
$frame = new FrameStub(
|
||||
array(
|
||||
'object' => isset($f['object']) ? $f['object'] : null,
|
||||
'class' => isset($f['class']) ? $f['class'] : null,
|
||||
'type' => isset($f['type']) ? $f['type'] : null,
|
||||
'function' => isset($f['function']) ? $f['function'] : null,
|
||||
) + $frames[$i - 1],
|
||||
false,
|
||||
true
|
||||
);
|
||||
$f = self::castFrameStub($frame, array(), $frame, true);
|
||||
if (isset($f[$prefix.'src'])) {
|
||||
foreach ($f[$prefix.'src']->value as $label => $frame) {
|
||||
if (0 === strpos($label, "\0~collapse=0")) {
|
||||
if ($collapse) {
|
||||
$label = substr_replace($label, '1', 11, 1);
|
||||
} else {
|
||||
$collapse = true;
|
||||
}
|
||||
}
|
||||
$label = substr_replace($label, "title=Stack level $j.&", 2, 0);
|
||||
}
|
||||
$f = $frames[$i - 1];
|
||||
if ($trace->keepArgs && !empty($f['args']) && $frame instanceof EnumStub) {
|
||||
$frame->value['arguments'] = new ArgsStub($f['args'], isset($f['function']) ? $f['function'] : null, isset($f['class']) ? $f['class'] : null);
|
||||
}
|
||||
} elseif ('???' !== $lastCall) {
|
||||
$label = new ClassStub($lastCall);
|
||||
if (isset($label->attr['ellipsis'])) {
|
||||
$label->attr['ellipsis'] += 2;
|
||||
$label = substr_replace($prefix, "ellipsis-type=class&ellipsis={$label->attr['ellipsis']}&ellipsis-tail=1&title=Stack level $j.", 2, 0).$label->value.'()';
|
||||
} else {
|
||||
$label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$label->value.'()';
|
||||
}
|
||||
} else {
|
||||
$label = substr_replace($prefix, "title=Stack level $j.", 2, 0).$lastCall;
|
||||
}
|
||||
$a[substr_replace($label, sprintf('separator=%s&', $frame instanceof EnumStub ? ' ' : ':'), 2, 0)] = $frame;
|
||||
|
||||
$lastCall = $call;
|
||||
}
|
||||
if (null !== $trace->sliceLength) {
|
||||
$a = array_slice($a, 0, $trace->sliceLength, true);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
if (!$isNested) {
|
||||
return $a;
|
||||
}
|
||||
$f = $frame->value;
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
if (isset($f['file'], $f['line'])) {
|
||||
$cacheKey = $f;
|
||||
unset($cacheKey['object'], $cacheKey['args']);
|
||||
$cacheKey[] = self::$srcContext;
|
||||
$cacheKey = implode('-', $cacheKey);
|
||||
|
||||
if (isset(self::$framesCache[$cacheKey])) {
|
||||
$a[$prefix.'src'] = self::$framesCache[$cacheKey];
|
||||
} else {
|
||||
if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) {
|
||||
$f['file'] = substr($f['file'], 0, -strlen($match[0]));
|
||||
$f['line'] = (int) $match[1];
|
||||
}
|
||||
$caller = isset($f['function']) ? sprintf('in %s() on line %d', (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'], $f['line']) : null;
|
||||
$src = $f['line'];
|
||||
$srcKey = $f['file'];
|
||||
$ellipsis = new LinkStub($srcKey, 0);
|
||||
$srcAttr = 'collapse='.(int) $ellipsis->inVendor;
|
||||
$ellipsisTail = isset($ellipsis->attr['ellipsis-tail']) ? $ellipsis->attr['ellipsis-tail'] : 0;
|
||||
$ellipsis = isset($ellipsis->attr['ellipsis']) ? $ellipsis->attr['ellipsis'] : 0;
|
||||
|
||||
if (file_exists($f['file']) && 0 <= self::$srcContext) {
|
||||
if (!empty($f['class']) && (is_subclass_of($f['class'], 'Twig\Template') || is_subclass_of($f['class'], 'Twig_Template')) && method_exists($f['class'], 'getDebugInfo')) {
|
||||
$template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', strlen($f['class']), $f['class']));
|
||||
|
||||
$ellipsis = 0;
|
||||
$templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : '');
|
||||
$templateInfo = $template->getDebugInfo();
|
||||
if (isset($templateInfo[$f['line']])) {
|
||||
if (!method_exists($template, 'getSourceContext') || !file_exists($templatePath = $template->getSourceContext()->getPath())) {
|
||||
$templatePath = null;
|
||||
}
|
||||
if ($templateSrc) {
|
||||
$src = self::extractSource($templateSrc, $templateInfo[$f['line']], self::$srcContext, $caller, 'twig', $templatePath);
|
||||
$srcKey = ($templatePath ?: $template->getTemplateName()).':'.$templateInfo[$f['line']];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($srcKey == $f['file']) {
|
||||
$src = self::extractSource(file_get_contents($f['file']), $f['line'], self::$srcContext, $caller, 'php', $f['file']);
|
||||
$srcKey .= ':'.$f['line'];
|
||||
if ($ellipsis) {
|
||||
$ellipsis += 1 + strlen($f['line']);
|
||||
}
|
||||
}
|
||||
$srcAttr .= '&separator= ';
|
||||
} else {
|
||||
$srcAttr .= '&separator=:';
|
||||
}
|
||||
$srcAttr .= $ellipsis ? '&ellipsis-type=path&ellipsis='.$ellipsis.'&ellipsis-tail='.$ellipsisTail : '';
|
||||
self::$framesCache[$cacheKey] = $a[$prefix.'src'] = new EnumStub(array("\0~$srcAttr\0$srcKey" => $src));
|
||||
}
|
||||
}
|
||||
|
||||
unset($a[$prefix.'args'], $a[$prefix.'line'], $a[$prefix.'file']);
|
||||
if ($frame->inTraceStub) {
|
||||
unset($a[$prefix.'class'], $a[$prefix.'type'], $a[$prefix.'function']);
|
||||
}
|
||||
foreach ($a as $k => $v) {
|
||||
if (!$v) {
|
||||
unset($a[$k]);
|
||||
}
|
||||
}
|
||||
if ($frame->keepArgs && !empty($f['args'])) {
|
||||
$a[$prefix.'arguments'] = new ArgsStub($f['args'], $f['function'], $f['class']);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
private static function filterExceptionArray($xClass, array $a, $xPrefix, $filter)
|
||||
{
|
||||
if (isset($a[$xPrefix.'trace'])) {
|
||||
$trace = $a[$xPrefix.'trace'];
|
||||
unset($a[$xPrefix.'trace']); // Ensures the trace is always last
|
||||
} else {
|
||||
$trace = array();
|
||||
}
|
||||
|
||||
if (!($filter & Caster::EXCLUDE_VERBOSE) && $trace) {
|
||||
if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
|
||||
self::traceUnshift($trace, $xClass, $a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
|
||||
}
|
||||
$a[Caster::PREFIX_VIRTUAL.'trace'] = new TraceStub($trace, self::$traceArgs);
|
||||
}
|
||||
if (empty($a[$xPrefix.'previous'])) {
|
||||
unset($a[$xPrefix.'previous']);
|
||||
}
|
||||
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);
|
||||
|
||||
if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
|
||||
$a[Caster::PREFIX_PROTECTED.'file'] = new LinkStub($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
private static function traceUnshift(&$trace, $class, $file, $line)
|
||||
{
|
||||
if (isset($trace[0]['file'], $trace[0]['line']) && $trace[0]['file'] === $file && $trace[0]['line'] === $line) {
|
||||
return;
|
||||
}
|
||||
array_unshift($trace, array(
|
||||
'function' => $class ? 'new '.$class : null,
|
||||
'file' => $file,
|
||||
'line' => $line,
|
||||
));
|
||||
}
|
||||
|
||||
private static function extractSource($srcLines, $line, $srcContext, $title, $lang, $file = null)
|
||||
{
|
||||
$srcLines = explode("\n", $srcLines);
|
||||
$src = array();
|
||||
|
||||
for ($i = $line - 1 - $srcContext; $i <= $line - 1 + $srcContext; ++$i) {
|
||||
$src[] = (isset($srcLines[$i]) ? $srcLines[$i] : '')."\n";
|
||||
}
|
||||
|
||||
$srcLines = array();
|
||||
$ltrim = 0;
|
||||
do {
|
||||
$pad = null;
|
||||
for ($i = $srcContext << 1; $i >= 0; --$i) {
|
||||
if (isset($src[$i][$ltrim]) && "\r" !== ($c = $src[$i][$ltrim]) && "\n" !== $c) {
|
||||
if (null === $pad) {
|
||||
$pad = $c;
|
||||
}
|
||||
if ((' ' !== $c && "\t" !== $c) || $pad !== $c) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
++$ltrim;
|
||||
} while (0 > $i && null !== $pad);
|
||||
|
||||
--$ltrim;
|
||||
|
||||
foreach ($src as $i => $c) {
|
||||
if ($ltrim) {
|
||||
$c = isset($c[$ltrim]) && "\r" !== $c[$ltrim] ? substr($c, $ltrim) : ltrim($c, " \t");
|
||||
}
|
||||
$c = substr($c, 0, -1);
|
||||
if ($i !== $srcContext) {
|
||||
$c = new ConstStub('default', $c);
|
||||
} else {
|
||||
$c = new ConstStub($c, $title);
|
||||
if (null !== $file) {
|
||||
$c->attr['file'] = $file;
|
||||
$c->attr['line'] = $line;
|
||||
}
|
||||
}
|
||||
$c->attr['lang'] = $lang;
|
||||
$srcLines[sprintf("\0~separator=› &%d\0", $i + $line - $srcContext)] = $c;
|
||||
}
|
||||
|
||||
return new EnumStub($srcLines);
|
||||
}
|
||||
}
|
30
vendor/symfony/var-dumper/Caster/FrameStub.php
vendored
Normal file
30
vendor/symfony/var-dumper/Caster/FrameStub.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
/**
|
||||
* Represents a single backtrace frame as returned by debug_backtrace() or Exception->getTrace().
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class FrameStub extends EnumStub
|
||||
{
|
||||
public $keepArgs;
|
||||
public $inTraceStub;
|
||||
|
||||
public function __construct(array $frame, $keepArgs = true, $inTraceStub = false)
|
||||
{
|
||||
$this->value = $frame;
|
||||
$this->keepArgs = $keepArgs;
|
||||
$this->inTraceStub = $inTraceStub;
|
||||
}
|
||||
}
|
108
vendor/symfony/var-dumper/Caster/LinkStub.php
vendored
Normal file
108
vendor/symfony/var-dumper/Caster/LinkStub.php
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
/**
|
||||
* Represents a file or a URL.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class LinkStub extends ConstStub
|
||||
{
|
||||
public $inVendor = false;
|
||||
|
||||
private static $vendorRoots;
|
||||
private static $composerRoots;
|
||||
|
||||
public function __construct($label, $line = 0, $href = null)
|
||||
{
|
||||
$this->value = $label;
|
||||
|
||||
if (null === $href) {
|
||||
$href = $label;
|
||||
}
|
||||
if (!is_string($href)) {
|
||||
return;
|
||||
}
|
||||
if (0 === strpos($href, 'file://')) {
|
||||
if ($href === $label) {
|
||||
$label = substr($label, 7);
|
||||
}
|
||||
$href = substr($href, 7);
|
||||
} elseif (false !== strpos($href, '://')) {
|
||||
$this->attr['href'] = $href;
|
||||
|
||||
return;
|
||||
}
|
||||
if (!file_exists($href)) {
|
||||
return;
|
||||
}
|
||||
if ($line) {
|
||||
$this->attr['line'] = $line;
|
||||
}
|
||||
if ($label !== $this->attr['file'] = realpath($href) ?: $href) {
|
||||
return;
|
||||
}
|
||||
if ($composerRoot = $this->getComposerRoot($href, $this->inVendor)) {
|
||||
$this->attr['ellipsis'] = strlen($href) - strlen($composerRoot) + 1;
|
||||
$this->attr['ellipsis-type'] = 'path';
|
||||
$this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + strlen(implode(array_slice(explode(DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0);
|
||||
} elseif (3 < count($ellipsis = explode(DIRECTORY_SEPARATOR, $href))) {
|
||||
$this->attr['ellipsis'] = 2 + strlen(implode(array_slice($ellipsis, -2)));
|
||||
$this->attr['ellipsis-type'] = 'path';
|
||||
$this->attr['ellipsis-tail'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
private function getComposerRoot($file, &$inVendor)
|
||||
{
|
||||
if (null === self::$vendorRoots) {
|
||||
self::$vendorRoots = array();
|
||||
|
||||
foreach (get_declared_classes() as $class) {
|
||||
if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) {
|
||||
$r = new \ReflectionClass($class);
|
||||
$v = dirname(dirname($r->getFileName()));
|
||||
if (file_exists($v.'/composer/installed.json')) {
|
||||
self::$vendorRoots[] = $v.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$inVendor = false;
|
||||
|
||||
if (isset(self::$composerRoots[$dir = dirname($file)])) {
|
||||
return self::$composerRoots[$dir];
|
||||
}
|
||||
|
||||
foreach (self::$vendorRoots as $root) {
|
||||
if ($inVendor = 0 === strpos($file, $root)) {
|
||||
return $root;
|
||||
}
|
||||
}
|
||||
|
||||
$parent = $dir;
|
||||
while (!@file_exists($parent.'/composer.json')) {
|
||||
if (!@file_exists($parent)) {
|
||||
// open_basedir restriction in effect
|
||||
break;
|
||||
}
|
||||
if ($parent === dirname($parent)) {
|
||||
return self::$composerRoots[$dir] = false;
|
||||
}
|
||||
|
||||
$parent = dirname($parent);
|
||||
}
|
||||
|
||||
return self::$composerRoots[$dir] = $parent.DIRECTORY_SEPARATOR;
|
||||
}
|
||||
}
|
38
vendor/symfony/var-dumper/Caster/MongoCaster.php
vendored
Normal file
38
vendor/symfony/var-dumper/Caster/MongoCaster.php
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
@trigger_error('The '.__NAMESPACE__.'\MongoCaster class is deprecated since Symfony 3.4 and will be removed in 4.0.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Casts classes from the MongoDb extension to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @deprecated since version 3.4, to be removed in 4.0.
|
||||
*/
|
||||
class MongoCaster
|
||||
{
|
||||
public static function castCursor(\MongoCursorInterface $cursor, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
if ($info = $cursor->info()) {
|
||||
foreach ($info as $k => $v) {
|
||||
$a[Caster::PREFIX_VIRTUAL.$k] = $v;
|
||||
}
|
||||
}
|
||||
$a[Caster::PREFIX_VIRTUAL.'dead'] = $cursor->dead();
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
120
vendor/symfony/var-dumper/Caster/PdoCaster.php
vendored
Normal file
120
vendor/symfony/var-dumper/Caster/PdoCaster.php
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts PDO related classes to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class PdoCaster
|
||||
{
|
||||
private static $pdoAttributes = array(
|
||||
'CASE' => array(
|
||||
\PDO::CASE_LOWER => 'LOWER',
|
||||
\PDO::CASE_NATURAL => 'NATURAL',
|
||||
\PDO::CASE_UPPER => 'UPPER',
|
||||
),
|
||||
'ERRMODE' => array(
|
||||
\PDO::ERRMODE_SILENT => 'SILENT',
|
||||
\PDO::ERRMODE_WARNING => 'WARNING',
|
||||
\PDO::ERRMODE_EXCEPTION => 'EXCEPTION',
|
||||
),
|
||||
'TIMEOUT',
|
||||
'PREFETCH',
|
||||
'AUTOCOMMIT',
|
||||
'PERSISTENT',
|
||||
'DRIVER_NAME',
|
||||
'SERVER_INFO',
|
||||
'ORACLE_NULLS' => array(
|
||||
\PDO::NULL_NATURAL => 'NATURAL',
|
||||
\PDO::NULL_EMPTY_STRING => 'EMPTY_STRING',
|
||||
\PDO::NULL_TO_STRING => 'TO_STRING',
|
||||
),
|
||||
'CLIENT_VERSION',
|
||||
'SERVER_VERSION',
|
||||
'STATEMENT_CLASS',
|
||||
'EMULATE_PREPARES',
|
||||
'CONNECTION_STATUS',
|
||||
'STRINGIFY_FETCHES',
|
||||
'DEFAULT_FETCH_MODE' => array(
|
||||
\PDO::FETCH_ASSOC => 'ASSOC',
|
||||
\PDO::FETCH_BOTH => 'BOTH',
|
||||
\PDO::FETCH_LAZY => 'LAZY',
|
||||
\PDO::FETCH_NUM => 'NUM',
|
||||
\PDO::FETCH_OBJ => 'OBJ',
|
||||
),
|
||||
);
|
||||
|
||||
public static function castPdo(\PDO $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$attr = array();
|
||||
$errmode = $c->getAttribute(\PDO::ATTR_ERRMODE);
|
||||
$c->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
foreach (self::$pdoAttributes as $k => $v) {
|
||||
if (!isset($k[0])) {
|
||||
$k = $v;
|
||||
$v = array();
|
||||
}
|
||||
|
||||
try {
|
||||
$attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(constant('PDO::ATTR_'.$k));
|
||||
if ($v && isset($v[$attr[$k]])) {
|
||||
$attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
if (isset($attr[$k = 'STATEMENT_CLASS'][1])) {
|
||||
if ($attr[$k][1]) {
|
||||
$attr[$k][1] = new ArgsStub($attr[$k][1], '__construct', $attr[$k][0]);
|
||||
}
|
||||
$attr[$k][0] = new ClassStub($attr[$k][0]);
|
||||
}
|
||||
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
$a += array(
|
||||
$prefix.'inTransaction' => method_exists($c, 'inTransaction'),
|
||||
$prefix.'errorInfo' => $c->errorInfo(),
|
||||
$prefix.'attributes' => new EnumStub($attr),
|
||||
);
|
||||
|
||||
if ($a[$prefix.'inTransaction']) {
|
||||
$a[$prefix.'inTransaction'] = $c->inTransaction();
|
||||
} else {
|
||||
unset($a[$prefix.'inTransaction']);
|
||||
}
|
||||
|
||||
if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
|
||||
unset($a[$prefix.'errorInfo']);
|
||||
}
|
||||
|
||||
$c->setAttribute(\PDO::ATTR_ERRMODE, $errmode);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castPdoStatement(\PDOStatement $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
$a[$prefix.'errorInfo'] = $c->errorInfo();
|
||||
|
||||
if (!isset($a[$prefix.'errorInfo'][1], $a[$prefix.'errorInfo'][2])) {
|
||||
unset($a[$prefix.'errorInfo']);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
154
vendor/symfony/var-dumper/Caster/PgSqlCaster.php
vendored
Normal file
154
vendor/symfony/var-dumper/Caster/PgSqlCaster.php
vendored
Normal file
|
@ -0,0 +1,154 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts pqsql resources to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class PgSqlCaster
|
||||
{
|
||||
private static $paramCodes = array(
|
||||
'server_encoding',
|
||||
'client_encoding',
|
||||
'is_superuser',
|
||||
'session_authorization',
|
||||
'DateStyle',
|
||||
'TimeZone',
|
||||
'IntervalStyle',
|
||||
'integer_datetimes',
|
||||
'application_name',
|
||||
'standard_conforming_strings',
|
||||
);
|
||||
|
||||
private static $transactionStatus = array(
|
||||
PGSQL_TRANSACTION_IDLE => 'PGSQL_TRANSACTION_IDLE',
|
||||
PGSQL_TRANSACTION_ACTIVE => 'PGSQL_TRANSACTION_ACTIVE',
|
||||
PGSQL_TRANSACTION_INTRANS => 'PGSQL_TRANSACTION_INTRANS',
|
||||
PGSQL_TRANSACTION_INERROR => 'PGSQL_TRANSACTION_INERROR',
|
||||
PGSQL_TRANSACTION_UNKNOWN => 'PGSQL_TRANSACTION_UNKNOWN',
|
||||
);
|
||||
|
||||
private static $resultStatus = array(
|
||||
PGSQL_EMPTY_QUERY => 'PGSQL_EMPTY_QUERY',
|
||||
PGSQL_COMMAND_OK => 'PGSQL_COMMAND_OK',
|
||||
PGSQL_TUPLES_OK => 'PGSQL_TUPLES_OK',
|
||||
PGSQL_COPY_OUT => 'PGSQL_COPY_OUT',
|
||||
PGSQL_COPY_IN => 'PGSQL_COPY_IN',
|
||||
PGSQL_BAD_RESPONSE => 'PGSQL_BAD_RESPONSE',
|
||||
PGSQL_NONFATAL_ERROR => 'PGSQL_NONFATAL_ERROR',
|
||||
PGSQL_FATAL_ERROR => 'PGSQL_FATAL_ERROR',
|
||||
);
|
||||
|
||||
private static $diagCodes = array(
|
||||
'severity' => PGSQL_DIAG_SEVERITY,
|
||||
'sqlstate' => PGSQL_DIAG_SQLSTATE,
|
||||
'message' => PGSQL_DIAG_MESSAGE_PRIMARY,
|
||||
'detail' => PGSQL_DIAG_MESSAGE_DETAIL,
|
||||
'hint' => PGSQL_DIAG_MESSAGE_HINT,
|
||||
'statement position' => PGSQL_DIAG_STATEMENT_POSITION,
|
||||
'internal position' => PGSQL_DIAG_INTERNAL_POSITION,
|
||||
'internal query' => PGSQL_DIAG_INTERNAL_QUERY,
|
||||
'context' => PGSQL_DIAG_CONTEXT,
|
||||
'file' => PGSQL_DIAG_SOURCE_FILE,
|
||||
'line' => PGSQL_DIAG_SOURCE_LINE,
|
||||
'function' => PGSQL_DIAG_SOURCE_FUNCTION,
|
||||
);
|
||||
|
||||
public static function castLargeObject($lo, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a['seek position'] = pg_lo_tell($lo);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castLink($link, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a['status'] = pg_connection_status($link);
|
||||
$a['status'] = new ConstStub(PGSQL_CONNECTION_OK === $a['status'] ? 'PGSQL_CONNECTION_OK' : 'PGSQL_CONNECTION_BAD', $a['status']);
|
||||
$a['busy'] = pg_connection_busy($link);
|
||||
|
||||
$a['transaction'] = pg_transaction_status($link);
|
||||
if (isset(self::$transactionStatus[$a['transaction']])) {
|
||||
$a['transaction'] = new ConstStub(self::$transactionStatus[$a['transaction']], $a['transaction']);
|
||||
}
|
||||
|
||||
$a['pid'] = pg_get_pid($link);
|
||||
$a['last error'] = pg_last_error($link);
|
||||
$a['last notice'] = pg_last_notice($link);
|
||||
$a['host'] = pg_host($link);
|
||||
$a['port'] = pg_port($link);
|
||||
$a['dbname'] = pg_dbname($link);
|
||||
$a['options'] = pg_options($link);
|
||||
$a['version'] = pg_version($link);
|
||||
|
||||
foreach (self::$paramCodes as $v) {
|
||||
if (false !== $s = pg_parameter_status($link, $v)) {
|
||||
$a['param'][$v] = $s;
|
||||
}
|
||||
}
|
||||
|
||||
$a['param']['client_encoding'] = pg_client_encoding($link);
|
||||
$a['param'] = new EnumStub($a['param']);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castResult($result, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a['num rows'] = pg_num_rows($result);
|
||||
$a['status'] = pg_result_status($result);
|
||||
if (isset(self::$resultStatus[$a['status']])) {
|
||||
$a['status'] = new ConstStub(self::$resultStatus[$a['status']], $a['status']);
|
||||
}
|
||||
$a['command-completion tag'] = pg_result_status($result, PGSQL_STATUS_STRING);
|
||||
|
||||
if (-1 === $a['num rows']) {
|
||||
foreach (self::$diagCodes as $k => $v) {
|
||||
$a['error'][$k] = pg_result_error_field($result, $v);
|
||||
}
|
||||
}
|
||||
|
||||
$a['affected rows'] = pg_affected_rows($result);
|
||||
$a['last OID'] = pg_last_oid($result);
|
||||
|
||||
$fields = pg_num_fields($result);
|
||||
|
||||
for ($i = 0; $i < $fields; ++$i) {
|
||||
$field = array(
|
||||
'name' => pg_field_name($result, $i),
|
||||
'table' => sprintf('%s (OID: %s)', pg_field_table($result, $i), pg_field_table($result, $i, true)),
|
||||
'type' => sprintf('%s (OID: %s)', pg_field_type($result, $i), pg_field_type_oid($result, $i)),
|
||||
'nullable' => (bool) pg_field_is_null($result, $i),
|
||||
'storage' => pg_field_size($result, $i).' bytes',
|
||||
'display' => pg_field_prtlen($result, $i).' chars',
|
||||
);
|
||||
if (' (OID: )' === $field['table']) {
|
||||
$field['table'] = null;
|
||||
}
|
||||
if ('-1 bytes' === $field['storage']) {
|
||||
$field['storage'] = 'variable size';
|
||||
} elseif ('1 bytes' === $field['storage']) {
|
||||
$field['storage'] = '1 byte';
|
||||
}
|
||||
if ('1 chars' === $field['display']) {
|
||||
$field['display'] = '1 char';
|
||||
}
|
||||
$a['fields'][] = new EnumStub($field);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
77
vendor/symfony/var-dumper/Caster/RedisCaster.php
vendored
Normal file
77
vendor/symfony/var-dumper/Caster/RedisCaster.php
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts Redis class from ext-redis to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class RedisCaster
|
||||
{
|
||||
private static $serializer = array(
|
||||
\Redis::SERIALIZER_NONE => 'NONE',
|
||||
\Redis::SERIALIZER_PHP => 'PHP',
|
||||
2 => 'IGBINARY', // Optional Redis::SERIALIZER_IGBINARY
|
||||
);
|
||||
|
||||
public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
if (defined('HHVM_VERSION_ID')) {
|
||||
if (isset($a[Caster::PREFIX_PROTECTED.'serializer'])) {
|
||||
$ser = $a[Caster::PREFIX_PROTECTED.'serializer'];
|
||||
$a[Caster::PREFIX_PROTECTED.'serializer'] = isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser;
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
if (!$connected = $c->isConnected()) {
|
||||
return $a + array(
|
||||
$prefix.'isConnected' => $connected,
|
||||
);
|
||||
}
|
||||
|
||||
$ser = $c->getOption(\Redis::OPT_SERIALIZER);
|
||||
$retry = defined('Redis::OPT_SCAN') ? $c->getOption(\Redis::OPT_SCAN) : 0;
|
||||
|
||||
return $a + array(
|
||||
$prefix.'isConnected' => $connected,
|
||||
$prefix.'host' => $c->getHost(),
|
||||
$prefix.'port' => $c->getPort(),
|
||||
$prefix.'auth' => $c->getAuth(),
|
||||
$prefix.'dbNum' => $c->getDbNum(),
|
||||
$prefix.'timeout' => $c->getTimeout(),
|
||||
$prefix.'persistentId' => $c->getPersistentID(),
|
||||
$prefix.'options' => new EnumStub(array(
|
||||
'READ_TIMEOUT' => $c->getOption(\Redis::OPT_READ_TIMEOUT),
|
||||
'SERIALIZER' => isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser,
|
||||
'PREFIX' => $c->getOption(\Redis::OPT_PREFIX),
|
||||
'SCAN' => new ConstStub($retry ? 'RETRY' : 'NORETRY', $retry),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
public static function castRedisArray(\RedisArray $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
return $a + array(
|
||||
$prefix.'hosts' => $c->_hosts(),
|
||||
$prefix.'function' => ClassStub::wrapCallable($c->_function()),
|
||||
);
|
||||
}
|
||||
}
|
336
vendor/symfony/var-dumper/Caster/ReflectionCaster.php
vendored
Normal file
336
vendor/symfony/var-dumper/Caster/ReflectionCaster.php
vendored
Normal file
|
@ -0,0 +1,336 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts Reflector related classes to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ReflectionCaster
|
||||
{
|
||||
private static $extraMap = array(
|
||||
'docComment' => 'getDocComment',
|
||||
'extension' => 'getExtensionName',
|
||||
'isDisabled' => 'isDisabled',
|
||||
'isDeprecated' => 'isDeprecated',
|
||||
'isInternal' => 'isInternal',
|
||||
'isUserDefined' => 'isUserDefined',
|
||||
'isGenerator' => 'isGenerator',
|
||||
'isVariadic' => 'isVariadic',
|
||||
);
|
||||
|
||||
public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested, $filter = 0)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
$c = new \ReflectionFunction($c);
|
||||
|
||||
$stub->class = 'Closure'; // HHVM generates unique class names for closures
|
||||
$a = static::castFunctionAbstract($c, $a, $stub, $isNested, $filter);
|
||||
|
||||
if (isset($a[$prefix.'parameters'])) {
|
||||
foreach ($a[$prefix.'parameters']->value as &$v) {
|
||||
$param = $v;
|
||||
$v = new EnumStub(array());
|
||||
foreach (static::castParameter($param, array(), $stub, true) as $k => $param) {
|
||||
if ("\0" === $k[0]) {
|
||||
$v->value[substr($k, 3)] = $param;
|
||||
}
|
||||
}
|
||||
unset($v->value['position'], $v->value['isVariadic'], $v->value['byReference'], $v);
|
||||
}
|
||||
}
|
||||
|
||||
if (!($filter & Caster::EXCLUDE_VERBOSE) && $f = $c->getFileName()) {
|
||||
$a[$prefix.'file'] = new LinkStub($f, $c->getStartLine());
|
||||
$a[$prefix.'line'] = $c->getStartLine().' to '.$c->getEndLine();
|
||||
}
|
||||
|
||||
$prefix = Caster::PREFIX_DYNAMIC;
|
||||
unset($a['name'], $a[$prefix.'this'], $a[$prefix.'parameter'], $a[Caster::PREFIX_VIRTUAL.'extra']);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castGenerator(\Generator $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
if (!class_exists('ReflectionGenerator', false)) {
|
||||
return $a;
|
||||
}
|
||||
|
||||
// Cannot create ReflectionGenerator based on a terminated Generator
|
||||
try {
|
||||
$reflectionGenerator = new \ReflectionGenerator($c);
|
||||
} catch (\Exception $e) {
|
||||
$a[Caster::PREFIX_VIRTUAL.'closed'] = true;
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
return self::castReflectionGenerator($reflectionGenerator, $a, $stub, $isNested);
|
||||
}
|
||||
|
||||
public static function castType(\ReflectionType $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
$a += array(
|
||||
$prefix.'name' => $c instanceof \ReflectionNamedType ? $c->getName() : $c->__toString(),
|
||||
$prefix.'allowsNull' => $c->allowsNull(),
|
||||
$prefix.'isBuiltin' => $c->isBuiltin(),
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castReflectionGenerator(\ReflectionGenerator $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
if ($c->getThis()) {
|
||||
$a[$prefix.'this'] = new CutStub($c->getThis());
|
||||
}
|
||||
$function = $c->getFunction();
|
||||
$frame = array(
|
||||
'class' => isset($function->class) ? $function->class : null,
|
||||
'type' => isset($function->class) ? ($function->isStatic() ? '::' : '->') : null,
|
||||
'function' => $function->name,
|
||||
'file' => $c->getExecutingFile(),
|
||||
'line' => $c->getExecutingLine(),
|
||||
);
|
||||
if ($trace = $c->getTrace(DEBUG_BACKTRACE_IGNORE_ARGS)) {
|
||||
$function = new \ReflectionGenerator($c->getExecutingGenerator());
|
||||
array_unshift($trace, array(
|
||||
'function' => 'yield',
|
||||
'file' => $function->getExecutingFile(),
|
||||
'line' => $function->getExecutingLine() - 1,
|
||||
));
|
||||
$trace[] = $frame;
|
||||
$a[$prefix.'trace'] = new TraceStub($trace, false, 0, -1, -1);
|
||||
} else {
|
||||
$function = new FrameStub($frame, false, true);
|
||||
$function = ExceptionCaster::castFrameStub($function, array(), $function, true);
|
||||
$a[$prefix.'executing'] = new EnumStub(array(
|
||||
"\0~separator= \0".$frame['class'].$frame['type'].$frame['function'].'()' => $function[$prefix.'src'],
|
||||
));
|
||||
}
|
||||
|
||||
$a[Caster::PREFIX_VIRTUAL.'closed'] = false;
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castClass(\ReflectionClass $c, array $a, Stub $stub, $isNested, $filter = 0)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
if ($n = \Reflection::getModifierNames($c->getModifiers())) {
|
||||
$a[$prefix.'modifiers'] = implode(' ', $n);
|
||||
}
|
||||
|
||||
self::addMap($a, $c, array(
|
||||
'extends' => 'getParentClass',
|
||||
'implements' => 'getInterfaceNames',
|
||||
'constants' => 'getConstants',
|
||||
));
|
||||
|
||||
foreach ($c->getProperties() as $n) {
|
||||
$a[$prefix.'properties'][$n->name] = $n;
|
||||
}
|
||||
|
||||
foreach ($c->getMethods() as $n) {
|
||||
$a[$prefix.'methods'][$n->name] = $n;
|
||||
}
|
||||
|
||||
if (!($filter & Caster::EXCLUDE_VERBOSE) && !$isNested) {
|
||||
self::addExtra($a, $c);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, array $a, Stub $stub, $isNested, $filter = 0)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
self::addMap($a, $c, array(
|
||||
'returnsReference' => 'returnsReference',
|
||||
'returnType' => 'getReturnType',
|
||||
'class' => 'getClosureScopeClass',
|
||||
'this' => 'getClosureThis',
|
||||
));
|
||||
|
||||
if (isset($a[$prefix.'returnType'])) {
|
||||
$v = $a[$prefix.'returnType'];
|
||||
$v = $v instanceof \ReflectionNamedType ? $v->getName() : $v->__toString();
|
||||
$a[$prefix.'returnType'] = new ClassStub($a[$prefix.'returnType']->allowsNull() ? '?'.$v : $v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
|
||||
}
|
||||
if (isset($a[$prefix.'class'])) {
|
||||
$a[$prefix.'class'] = new ClassStub($a[$prefix.'class']);
|
||||
}
|
||||
if (isset($a[$prefix.'this'])) {
|
||||
$a[$prefix.'this'] = new CutStub($a[$prefix.'this']);
|
||||
}
|
||||
|
||||
foreach ($c->getParameters() as $v) {
|
||||
$k = '$'.$v->name;
|
||||
if (method_exists($v, 'isVariadic') && $v->isVariadic()) {
|
||||
$k = '...'.$k;
|
||||
}
|
||||
if ($v->isPassedByReference()) {
|
||||
$k = '&'.$k;
|
||||
}
|
||||
$a[$prefix.'parameters'][$k] = $v;
|
||||
}
|
||||
if (isset($a[$prefix.'parameters'])) {
|
||||
$a[$prefix.'parameters'] = new EnumStub($a[$prefix.'parameters']);
|
||||
}
|
||||
|
||||
if ($v = $c->getStaticVariables()) {
|
||||
foreach ($v as $k => &$v) {
|
||||
if (is_object($v)) {
|
||||
$a[$prefix.'use']['$'.$k] = new CutStub($v);
|
||||
} else {
|
||||
$a[$prefix.'use']['$'.$k] = &$v;
|
||||
}
|
||||
}
|
||||
unset($v);
|
||||
$a[$prefix.'use'] = new EnumStub($a[$prefix.'use']);
|
||||
}
|
||||
|
||||
if (!($filter & Caster::EXCLUDE_VERBOSE) && !$isNested) {
|
||||
self::addExtra($a, $c);
|
||||
}
|
||||
|
||||
// Added by HHVM
|
||||
unset($a[Caster::PREFIX_DYNAMIC.'static']);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castMethod(\ReflectionMethod $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castParameter(\ReflectionParameter $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
// Added by HHVM
|
||||
unset($a['info']);
|
||||
|
||||
self::addMap($a, $c, array(
|
||||
'position' => 'getPosition',
|
||||
'isVariadic' => 'isVariadic',
|
||||
'byReference' => 'isPassedByReference',
|
||||
'allowsNull' => 'allowsNull',
|
||||
));
|
||||
|
||||
if (method_exists($c, 'getType')) {
|
||||
if ($v = $c->getType()) {
|
||||
$a[$prefix.'typeHint'] = $v instanceof \ReflectionNamedType ? $v->getName() : $v->__toString();
|
||||
}
|
||||
} elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $c, $v)) {
|
||||
$a[$prefix.'typeHint'] = $v[1];
|
||||
}
|
||||
|
||||
if (isset($a[$prefix.'typeHint'])) {
|
||||
$v = $a[$prefix.'typeHint'];
|
||||
$a[$prefix.'typeHint'] = new ClassStub($v, array(class_exists($v, false) || interface_exists($v, false) || trait_exists($v, false) ? $v : '', ''));
|
||||
} else {
|
||||
unset($a[$prefix.'allowsNull']);
|
||||
}
|
||||
|
||||
try {
|
||||
$a[$prefix.'default'] = $v = $c->getDefaultValue();
|
||||
if (method_exists($c, 'isDefaultValueConstant') && $c->isDefaultValueConstant()) {
|
||||
$a[$prefix.'default'] = new ConstStub($c->getDefaultValueConstantName(), $v);
|
||||
}
|
||||
if (null === $v) {
|
||||
unset($a[$prefix.'allowsNull']);
|
||||
}
|
||||
} catch (\ReflectionException $e) {
|
||||
if (isset($a[$prefix.'typeHint']) && $c->allowsNull() && !class_exists('ReflectionNamedType', false)) {
|
||||
$a[$prefix.'default'] = null;
|
||||
unset($a[$prefix.'allowsNull']);
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castProperty(\ReflectionProperty $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a[Caster::PREFIX_VIRTUAL.'modifiers'] = implode(' ', \Reflection::getModifierNames($c->getModifiers()));
|
||||
self::addExtra($a, $c);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castExtension(\ReflectionExtension $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
self::addMap($a, $c, array(
|
||||
'version' => 'getVersion',
|
||||
'dependencies' => 'getDependencies',
|
||||
'iniEntries' => 'getIniEntries',
|
||||
'isPersistent' => 'isPersistent',
|
||||
'isTemporary' => 'isTemporary',
|
||||
'constants' => 'getConstants',
|
||||
'functions' => 'getFunctions',
|
||||
'classes' => 'getClasses',
|
||||
));
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castZendExtension(\ReflectionZendExtension $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
self::addMap($a, $c, array(
|
||||
'version' => 'getVersion',
|
||||
'author' => 'getAuthor',
|
||||
'copyright' => 'getCopyright',
|
||||
'url' => 'getURL',
|
||||
));
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
private static function addExtra(&$a, \Reflector $c)
|
||||
{
|
||||
$x = isset($a[Caster::PREFIX_VIRTUAL.'extra']) ? $a[Caster::PREFIX_VIRTUAL.'extra']->value : array();
|
||||
|
||||
if (method_exists($c, 'getFileName') && $m = $c->getFileName()) {
|
||||
$x['file'] = new LinkStub($m, $c->getStartLine());
|
||||
$x['line'] = $c->getStartLine().' to '.$c->getEndLine();
|
||||
}
|
||||
|
||||
self::addMap($x, $c, self::$extraMap, '');
|
||||
|
||||
if ($x) {
|
||||
$a[Caster::PREFIX_VIRTUAL.'extra'] = new EnumStub($x);
|
||||
}
|
||||
}
|
||||
|
||||
private static function addMap(&$a, \Reflector $c, $map, $prefix = Caster::PREFIX_VIRTUAL)
|
||||
{
|
||||
foreach ($map as $k => $m) {
|
||||
if (method_exists($c, $m) && false !== ($m = $c->$m()) && null !== $m) {
|
||||
$a[$prefix.$k] = $m instanceof \Reflector ? $m->name : $m;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
72
vendor/symfony/var-dumper/Caster/ResourceCaster.php
vendored
Normal file
72
vendor/symfony/var-dumper/Caster/ResourceCaster.php
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts common resource types to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ResourceCaster
|
||||
{
|
||||
public static function castCurl($h, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
return curl_getinfo($h);
|
||||
}
|
||||
|
||||
public static function castDba($dba, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$list = dba_list();
|
||||
$a['file'] = $list[(int) $dba];
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castProcess($process, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
return proc_get_status($process);
|
||||
}
|
||||
|
||||
public static function castStream($stream, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a = stream_get_meta_data($stream) + static::castStreamContext($stream, $a, $stub, $isNested);
|
||||
if (isset($a['uri'])) {
|
||||
$a['uri'] = new LinkStub($a['uri']);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castStreamContext($stream, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
return @stream_context_get_params($stream) ?: $a;
|
||||
}
|
||||
|
||||
public static function castGd($gd, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a['size'] = imagesx($gd).'x'.imagesy($gd);
|
||||
$a['trueColor'] = imageistruecolor($gd);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castMysqlLink($h, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a['host'] = mysql_get_host_info($h);
|
||||
$a['protocol'] = mysql_get_proto_info($h);
|
||||
$a['server'] = mysql_get_server_info($h);
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
207
vendor/symfony/var-dumper/Caster/SplCaster.php
vendored
Normal file
207
vendor/symfony/var-dumper/Caster/SplCaster.php
vendored
Normal file
|
@ -0,0 +1,207 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts SPL related classes to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class SplCaster
|
||||
{
|
||||
private static $splFileObjectFlags = array(
|
||||
\SplFileObject::DROP_NEW_LINE => 'DROP_NEW_LINE',
|
||||
\SplFileObject::READ_AHEAD => 'READ_AHEAD',
|
||||
\SplFileObject::SKIP_EMPTY => 'SKIP_EMPTY',
|
||||
\SplFileObject::READ_CSV => 'READ_CSV',
|
||||
);
|
||||
|
||||
public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
$class = $stub->class;
|
||||
$flags = $c->getFlags();
|
||||
|
||||
$b = array(
|
||||
$prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST),
|
||||
$prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS),
|
||||
$prefix.'iteratorClass' => new ClassStub($c->getIteratorClass()),
|
||||
$prefix.'storage' => $c->getArrayCopy(),
|
||||
);
|
||||
|
||||
if ('ArrayObject' === $class) {
|
||||
$a = $b;
|
||||
} else {
|
||||
if (!($flags & \ArrayObject::STD_PROP_LIST)) {
|
||||
$c->setFlags(\ArrayObject::STD_PROP_LIST);
|
||||
$a = Caster::castObject($c, $class);
|
||||
$c->setFlags($flags);
|
||||
}
|
||||
|
||||
$a += $b;
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castHeap(\Iterator $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
Caster::PREFIX_VIRTUAL.'heap' => iterator_to_array(clone $c),
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castDoublyLinkedList(\SplDoublyLinkedList $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
$mode = $c->getIteratorMode();
|
||||
$c->setIteratorMode(\SplDoublyLinkedList::IT_MODE_KEEP | $mode & ~\SplDoublyLinkedList::IT_MODE_DELETE);
|
||||
|
||||
$a += array(
|
||||
$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),
|
||||
$prefix.'dllist' => iterator_to_array($c),
|
||||
);
|
||||
$c->setIteratorMode($mode);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
static $map = array(
|
||||
'path' => 'getPath',
|
||||
'filename' => 'getFilename',
|
||||
'basename' => 'getBasename',
|
||||
'pathname' => 'getPathname',
|
||||
'extension' => 'getExtension',
|
||||
'realPath' => 'getRealPath',
|
||||
'aTime' => 'getATime',
|
||||
'mTime' => 'getMTime',
|
||||
'cTime' => 'getCTime',
|
||||
'inode' => 'getInode',
|
||||
'size' => 'getSize',
|
||||
'perms' => 'getPerms',
|
||||
'owner' => 'getOwner',
|
||||
'group' => 'getGroup',
|
||||
'type' => 'getType',
|
||||
'writable' => 'isWritable',
|
||||
'readable' => 'isReadable',
|
||||
'executable' => 'isExecutable',
|
||||
'file' => 'isFile',
|
||||
'dir' => 'isDir',
|
||||
'link' => 'isLink',
|
||||
'linkTarget' => 'getLinkTarget',
|
||||
);
|
||||
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
foreach ($map as $key => $accessor) {
|
||||
try {
|
||||
$a[$prefix.$key] = $c->$accessor();
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($a[$prefix.'realPath'])) {
|
||||
$a[$prefix.'realPath'] = new LinkStub($a[$prefix.'realPath']);
|
||||
}
|
||||
|
||||
if (isset($a[$prefix.'perms'])) {
|
||||
$a[$prefix.'perms'] = new ConstStub(sprintf('0%o', $a[$prefix.'perms']), $a[$prefix.'perms']);
|
||||
}
|
||||
|
||||
static $mapDate = array('aTime', 'mTime', 'cTime');
|
||||
foreach ($mapDate as $key) {
|
||||
if (isset($a[$prefix.$key])) {
|
||||
$a[$prefix.$key] = new ConstStub(date('Y-m-d H:i:s', $a[$prefix.$key]), $a[$prefix.$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castFileObject(\SplFileObject $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
static $map = array(
|
||||
'csvControl' => 'getCsvControl',
|
||||
'flags' => 'getFlags',
|
||||
'maxLineLen' => 'getMaxLineLen',
|
||||
'fstat' => 'fstat',
|
||||
'eof' => 'eof',
|
||||
'key' => 'key',
|
||||
);
|
||||
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
foreach ($map as $key => $accessor) {
|
||||
try {
|
||||
$a[$prefix.$key] = $c->$accessor();
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($a[$prefix.'flags'])) {
|
||||
$flagsArray = array();
|
||||
foreach (self::$splFileObjectFlags as $value => $name) {
|
||||
if ($a[$prefix.'flags'] & $value) {
|
||||
$flagsArray[] = $name;
|
||||
}
|
||||
}
|
||||
$a[$prefix.'flags'] = new ConstStub(implode('|', $flagsArray), $a[$prefix.'flags']);
|
||||
}
|
||||
|
||||
if (isset($a[$prefix.'fstat'])) {
|
||||
$a[$prefix.'fstat'] = new CutArrayStub($a[$prefix.'fstat'], array('dev', 'ino', 'nlink', 'rdev', 'blksize', 'blocks'));
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castFixedArray(\SplFixedArray $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a += array(
|
||||
Caster::PREFIX_VIRTUAL.'storage' => $c->toArray(),
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$storage = array();
|
||||
unset($a[Caster::PREFIX_DYNAMIC."\0gcdata"]); // Don't hit https://bugs.php.net/65967
|
||||
|
||||
foreach (clone $c as $obj) {
|
||||
$storage[spl_object_hash($obj)] = array(
|
||||
'object' => $obj,
|
||||
'info' => $c->getInfo(),
|
||||
);
|
||||
}
|
||||
|
||||
$a += array(
|
||||
Caster::PREFIX_VIRTUAL.'storage' => $storage,
|
||||
);
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a[Caster::PREFIX_VIRTUAL.'innerIterator'] = $c->getInnerIterator();
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
82
vendor/symfony/var-dumper/Caster/StubCaster.php
vendored
Normal file
82
vendor/symfony/var-dumper/Caster/StubCaster.php
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts a caster's Stub.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class StubCaster
|
||||
{
|
||||
public static function castStub(Stub $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
if ($isNested) {
|
||||
$stub->type = $c->type;
|
||||
$stub->class = $c->class;
|
||||
$stub->value = $c->value;
|
||||
$stub->handle = $c->handle;
|
||||
$stub->cut = $c->cut;
|
||||
$stub->attr = $c->attr;
|
||||
|
||||
if (Stub::TYPE_REF === $c->type && !$c->class && is_string($c->value) && !preg_match('//u', $c->value)) {
|
||||
$stub->type = Stub::TYPE_STRING;
|
||||
$stub->class = Stub::STRING_BINARY;
|
||||
}
|
||||
|
||||
$a = array();
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
return $isNested ? $c->preservedSubset : $a;
|
||||
}
|
||||
|
||||
public static function cutInternals($obj, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
if ($isNested) {
|
||||
$stub->cut += count($a);
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
public static function castEnum(EnumStub $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
if ($isNested) {
|
||||
$stub->class = $c->dumpKeys ? '' : null;
|
||||
$stub->handle = 0;
|
||||
$stub->value = null;
|
||||
$stub->cut = $c->cut;
|
||||
$stub->attr = $c->attr;
|
||||
|
||||
$a = array();
|
||||
|
||||
if ($c->value) {
|
||||
foreach (array_keys($c->value) as $k) {
|
||||
$keys[] = !isset($k[0]) || "\0" !== $k[0] ? Caster::PREFIX_VIRTUAL.$k : $k;
|
||||
}
|
||||
// Preserve references with array_combine()
|
||||
$a = array_combine($keys, $c->value);
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
43
vendor/symfony/var-dumper/Caster/SymfonyCaster.php
vendored
Normal file
43
vendor/symfony/var-dumper/Caster/SymfonyCaster.php
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
class SymfonyCaster
|
||||
{
|
||||
private static $requestGetters = array(
|
||||
'pathInfo' => 'getPathInfo',
|
||||
'requestUri' => 'getRequestUri',
|
||||
'baseUrl' => 'getBaseUrl',
|
||||
'basePath' => 'getBasePath',
|
||||
'method' => 'getMethod',
|
||||
'format' => 'getRequestFormat',
|
||||
);
|
||||
|
||||
public static function castRequest(Request $request, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$clone = null;
|
||||
|
||||
foreach (self::$requestGetters as $prop => $getter) {
|
||||
if (null === $a[Caster::PREFIX_PROTECTED.$prop]) {
|
||||
if (null === $clone) {
|
||||
$clone = clone $request;
|
||||
}
|
||||
$a[Caster::PREFIX_VIRTUAL.$prop] = $clone->{$getter}();
|
||||
}
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
36
vendor/symfony/var-dumper/Caster/TraceStub.php
vendored
Normal file
36
vendor/symfony/var-dumper/Caster/TraceStub.php
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Represents a backtrace as returned by debug_backtrace() or Exception->getTrace().
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class TraceStub extends Stub
|
||||
{
|
||||
public $keepArgs;
|
||||
public $sliceOffset;
|
||||
public $sliceLength;
|
||||
public $numberingOffset;
|
||||
|
||||
public function __construct(array $trace, $keepArgs = true, $sliceOffset = 0, $sliceLength = null, $numberingOffset = 0)
|
||||
{
|
||||
$this->value = $trace;
|
||||
$this->keepArgs = $keepArgs;
|
||||
$this->sliceOffset = $sliceOffset;
|
||||
$this->sliceLength = $sliceLength;
|
||||
$this->numberingOffset = $numberingOffset;
|
||||
}
|
||||
}
|
77
vendor/symfony/var-dumper/Caster/XmlReaderCaster.php
vendored
Normal file
77
vendor/symfony/var-dumper/Caster/XmlReaderCaster.php
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts XmlReader class to array representation.
|
||||
*
|
||||
* @author Baptiste Clavié <clavie.b@gmail.com>
|
||||
*/
|
||||
class XmlReaderCaster
|
||||
{
|
||||
private static $nodeTypes = array(
|
||||
\XMLReader::NONE => 'NONE',
|
||||
\XMLReader::ELEMENT => 'ELEMENT',
|
||||
\XMLReader::ATTRIBUTE => 'ATTRIBUTE',
|
||||
\XMLReader::TEXT => 'TEXT',
|
||||
\XMLReader::CDATA => 'CDATA',
|
||||
\XMLReader::ENTITY_REF => 'ENTITY_REF',
|
||||
\XMLReader::ENTITY => 'ENTITY',
|
||||
\XMLReader::PI => 'PI (Processing Instruction)',
|
||||
\XMLReader::COMMENT => 'COMMENT',
|
||||
\XMLReader::DOC => 'DOC',
|
||||
\XMLReader::DOC_TYPE => 'DOC_TYPE',
|
||||
\XMLReader::DOC_FRAGMENT => 'DOC_FRAGMENT',
|
||||
\XMLReader::NOTATION => 'NOTATION',
|
||||
\XMLReader::WHITESPACE => 'WHITESPACE',
|
||||
\XMLReader::SIGNIFICANT_WHITESPACE => 'SIGNIFICANT_WHITESPACE',
|
||||
\XMLReader::END_ELEMENT => 'END_ELEMENT',
|
||||
\XMLReader::END_ENTITY => 'END_ENTITY',
|
||||
\XMLReader::XML_DECLARATION => 'XML_DECLARATION',
|
||||
);
|
||||
|
||||
public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$props = Caster::PREFIX_VIRTUAL.'parserProperties';
|
||||
$info = array(
|
||||
'localName' => $reader->localName,
|
||||
'prefix' => $reader->prefix,
|
||||
'nodeType' => new ConstStub(self::$nodeTypes[$reader->nodeType], $reader->nodeType),
|
||||
'depth' => $reader->depth,
|
||||
'isDefault' => $reader->isDefault,
|
||||
'isEmptyElement' => \XMLReader::NONE === $reader->nodeType ? null : $reader->isEmptyElement,
|
||||
'xmlLang' => $reader->xmlLang,
|
||||
'attributeCount' => $reader->attributeCount,
|
||||
'value' => $reader->value,
|
||||
'namespaceURI' => $reader->namespaceURI,
|
||||
'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI,
|
||||
$props => array(
|
||||
'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD),
|
||||
'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS),
|
||||
'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE),
|
||||
'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
|
||||
),
|
||||
);
|
||||
|
||||
if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, array(), $count)) {
|
||||
$info[$props] = new EnumStub($info[$props]);
|
||||
$info[$props]->cut = $count;
|
||||
}
|
||||
|
||||
$info = Caster::filter($info, Caster::EXCLUDE_EMPTY, array(), $count);
|
||||
// +2 because hasValue and hasAttributes are always filtered
|
||||
$stub->cut += $count + 2;
|
||||
|
||||
return $a + $info;
|
||||
}
|
||||
}
|
61
vendor/symfony/var-dumper/Caster/XmlResourceCaster.php
vendored
Normal file
61
vendor/symfony/var-dumper/Caster/XmlResourceCaster.php
vendored
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Caster;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* Casts XML resources to array representation.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class XmlResourceCaster
|
||||
{
|
||||
private static $xmlErrors = array(
|
||||
XML_ERROR_NONE => 'XML_ERROR_NONE',
|
||||
XML_ERROR_NO_MEMORY => 'XML_ERROR_NO_MEMORY',
|
||||
XML_ERROR_SYNTAX => 'XML_ERROR_SYNTAX',
|
||||
XML_ERROR_NO_ELEMENTS => 'XML_ERROR_NO_ELEMENTS',
|
||||
XML_ERROR_INVALID_TOKEN => 'XML_ERROR_INVALID_TOKEN',
|
||||
XML_ERROR_UNCLOSED_TOKEN => 'XML_ERROR_UNCLOSED_TOKEN',
|
||||
XML_ERROR_PARTIAL_CHAR => 'XML_ERROR_PARTIAL_CHAR',
|
||||
XML_ERROR_TAG_MISMATCH => 'XML_ERROR_TAG_MISMATCH',
|
||||
XML_ERROR_DUPLICATE_ATTRIBUTE => 'XML_ERROR_DUPLICATE_ATTRIBUTE',
|
||||
XML_ERROR_JUNK_AFTER_DOC_ELEMENT => 'XML_ERROR_JUNK_AFTER_DOC_ELEMENT',
|
||||
XML_ERROR_PARAM_ENTITY_REF => 'XML_ERROR_PARAM_ENTITY_REF',
|
||||
XML_ERROR_UNDEFINED_ENTITY => 'XML_ERROR_UNDEFINED_ENTITY',
|
||||
XML_ERROR_RECURSIVE_ENTITY_REF => 'XML_ERROR_RECURSIVE_ENTITY_REF',
|
||||
XML_ERROR_ASYNC_ENTITY => 'XML_ERROR_ASYNC_ENTITY',
|
||||
XML_ERROR_BAD_CHAR_REF => 'XML_ERROR_BAD_CHAR_REF',
|
||||
XML_ERROR_BINARY_ENTITY_REF => 'XML_ERROR_BINARY_ENTITY_REF',
|
||||
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF => 'XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF',
|
||||
XML_ERROR_MISPLACED_XML_PI => 'XML_ERROR_MISPLACED_XML_PI',
|
||||
XML_ERROR_UNKNOWN_ENCODING => 'XML_ERROR_UNKNOWN_ENCODING',
|
||||
XML_ERROR_INCORRECT_ENCODING => 'XML_ERROR_INCORRECT_ENCODING',
|
||||
XML_ERROR_UNCLOSED_CDATA_SECTION => 'XML_ERROR_UNCLOSED_CDATA_SECTION',
|
||||
XML_ERROR_EXTERNAL_ENTITY_HANDLING => 'XML_ERROR_EXTERNAL_ENTITY_HANDLING',
|
||||
);
|
||||
|
||||
public static function castXml($h, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$a['current_byte_index'] = xml_get_current_byte_index($h);
|
||||
$a['current_column_number'] = xml_get_current_column_number($h);
|
||||
$a['current_line_number'] = xml_get_current_line_number($h);
|
||||
$a['error_code'] = xml_get_error_code($h);
|
||||
|
||||
if (isset(self::$xmlErrors[$a['error_code']])) {
|
||||
$a['error_code'] = new ConstStub(self::$xmlErrors[$a['error_code']], $a['error_code']);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
331
vendor/symfony/var-dumper/Cloner/AbstractCloner.php
vendored
Normal file
331
vendor/symfony/var-dumper/Cloner/AbstractCloner.php
vendored
Normal file
|
@ -0,0 +1,331 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Cloner;
|
||||
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Exception\ThrowingCasterException;
|
||||
|
||||
/**
|
||||
* AbstractCloner implements a generic caster mechanism for objects and resources.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
abstract class AbstractCloner implements ClonerInterface
|
||||
{
|
||||
public static $defaultCasters = array(
|
||||
'__PHP_Incomplete_Class' => array('Symfony\Component\VarDumper\Caster\Caster', 'castPhpIncompleteClass'),
|
||||
|
||||
'Symfony\Component\VarDumper\Caster\CutStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'),
|
||||
'Symfony\Component\VarDumper\Caster\CutArrayStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castCutArray'),
|
||||
'Symfony\Component\VarDumper\Caster\ConstStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castStub'),
|
||||
'Symfony\Component\VarDumper\Caster\EnumStub' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'castEnum'),
|
||||
|
||||
'Closure' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClosure'),
|
||||
'Generator' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castGenerator'),
|
||||
'ReflectionType' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castType'),
|
||||
'ReflectionGenerator' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castReflectionGenerator'),
|
||||
'ReflectionClass' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castClass'),
|
||||
'ReflectionFunctionAbstract' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castFunctionAbstract'),
|
||||
'ReflectionMethod' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castMethod'),
|
||||
'ReflectionParameter' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castParameter'),
|
||||
'ReflectionProperty' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castProperty'),
|
||||
'ReflectionExtension' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castExtension'),
|
||||
'ReflectionZendExtension' => array('Symfony\Component\VarDumper\Caster\ReflectionCaster', 'castZendExtension'),
|
||||
|
||||
'Doctrine\Common\Persistence\ObjectManager' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'),
|
||||
'Doctrine\Common\Proxy\Proxy' => array('Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castCommonProxy'),
|
||||
'Doctrine\ORM\Proxy\Proxy' => array('Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castOrmProxy'),
|
||||
'Doctrine\ORM\PersistentCollection' => array('Symfony\Component\VarDumper\Caster\DoctrineCaster', 'castPersistentCollection'),
|
||||
|
||||
'DOMException' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castException'),
|
||||
'DOMStringList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'),
|
||||
'DOMNameList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'),
|
||||
'DOMImplementation' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castImplementation'),
|
||||
'DOMImplementationList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'),
|
||||
'DOMNode' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castNode'),
|
||||
'DOMNameSpaceNode' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castNameSpaceNode'),
|
||||
'DOMDocument' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocument'),
|
||||
'DOMNodeList' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'),
|
||||
'DOMNamedNodeMap' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLength'),
|
||||
'DOMCharacterData' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castCharacterData'),
|
||||
'DOMAttr' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castAttr'),
|
||||
'DOMElement' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castElement'),
|
||||
'DOMText' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castText'),
|
||||
'DOMTypeinfo' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castTypeinfo'),
|
||||
'DOMDomError' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castDomError'),
|
||||
'DOMLocator' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castLocator'),
|
||||
'DOMDocumentType' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castDocumentType'),
|
||||
'DOMNotation' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castNotation'),
|
||||
'DOMEntity' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castEntity'),
|
||||
'DOMProcessingInstruction' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castProcessingInstruction'),
|
||||
'DOMXPath' => array('Symfony\Component\VarDumper\Caster\DOMCaster', 'castXPath'),
|
||||
|
||||
'XmlReader' => array('Symfony\Component\VarDumper\Caster\XmlReaderCaster', 'castXmlReader'),
|
||||
|
||||
'ErrorException' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castErrorException'),
|
||||
'Exception' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castException'),
|
||||
'Error' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castError'),
|
||||
'Symfony\Component\DependencyInjection\ContainerInterface' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'),
|
||||
'Symfony\Component\HttpFoundation\Request' => array('Symfony\Component\VarDumper\Caster\SymfonyCaster', 'castRequest'),
|
||||
'Symfony\Component\VarDumper\Exception\ThrowingCasterException' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castThrowingCasterException'),
|
||||
'Symfony\Component\VarDumper\Caster\TraceStub' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castTraceStub'),
|
||||
'Symfony\Component\VarDumper\Caster\FrameStub' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castFrameStub'),
|
||||
'Symfony\Component\Debug\Exception\SilencedErrorContext' => array('Symfony\Component\VarDumper\Caster\ExceptionCaster', 'castSilencedErrorContext'),
|
||||
|
||||
'PHPUnit_Framework_MockObject_MockObject' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'),
|
||||
'Prophecy\Prophecy\ProphecySubjectInterface' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'),
|
||||
'Mockery\MockInterface' => array('Symfony\Component\VarDumper\Caster\StubCaster', 'cutInternals'),
|
||||
|
||||
'PDO' => array('Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdo'),
|
||||
'PDOStatement' => array('Symfony\Component\VarDumper\Caster\PdoCaster', 'castPdoStatement'),
|
||||
|
||||
'AMQPConnection' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castConnection'),
|
||||
'AMQPChannel' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castChannel'),
|
||||
'AMQPQueue' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castQueue'),
|
||||
'AMQPExchange' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castExchange'),
|
||||
'AMQPEnvelope' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castEnvelope'),
|
||||
|
||||
'ArrayObject' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayObject'),
|
||||
'SplDoublyLinkedList' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'),
|
||||
'SplFileInfo' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'),
|
||||
'SplFileObject' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'),
|
||||
'SplFixedArray' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFixedArray'),
|
||||
'SplHeap' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'),
|
||||
'SplObjectStorage' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castObjectStorage'),
|
||||
'SplPriorityQueue' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castHeap'),
|
||||
'OuterIterator' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castOuterIterator'),
|
||||
|
||||
'MongoCursorInterface' => array('Symfony\Component\VarDumper\Caster\MongoCaster', 'castCursor'),
|
||||
|
||||
'Redis' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedis'),
|
||||
'RedisArray' => array('Symfony\Component\VarDumper\Caster\RedisCaster', 'castRedisArray'),
|
||||
|
||||
'DateTimeInterface' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castDateTime'),
|
||||
'DateInterval' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castInterval'),
|
||||
'DateTimeZone' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castTimeZone'),
|
||||
'DatePeriod' => array('Symfony\Component\VarDumper\Caster\DateCaster', 'castPeriod'),
|
||||
|
||||
':curl' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castCurl'),
|
||||
':dba' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'),
|
||||
':dba persistent' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castDba'),
|
||||
':gd' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castGd'),
|
||||
':mysql link' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castMysqlLink'),
|
||||
':pgsql large object' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLargeObject'),
|
||||
':pgsql link' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'),
|
||||
':pgsql link persistent' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castLink'),
|
||||
':pgsql result' => array('Symfony\Component\VarDumper\Caster\PgSqlCaster', 'castResult'),
|
||||
':process' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castProcess'),
|
||||
':stream' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'),
|
||||
':persistent stream' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStream'),
|
||||
':stream-context' => array('Symfony\Component\VarDumper\Caster\ResourceCaster', 'castStreamContext'),
|
||||
':xml' => array('Symfony\Component\VarDumper\Caster\XmlResourceCaster', 'castXml'),
|
||||
);
|
||||
|
||||
protected $maxItems = 2500;
|
||||
protected $maxString = -1;
|
||||
protected $minDepth = 1;
|
||||
protected $useExt;
|
||||
|
||||
private $casters = array();
|
||||
private $prevErrorHandler;
|
||||
private $classInfo = array();
|
||||
private $filter = 0;
|
||||
|
||||
/**
|
||||
* @param callable[]|null $casters A map of casters
|
||||
*
|
||||
* @see addCasters
|
||||
*/
|
||||
public function __construct(array $casters = null)
|
||||
{
|
||||
if (null === $casters) {
|
||||
$casters = static::$defaultCasters;
|
||||
}
|
||||
$this->addCasters($casters);
|
||||
$this->useExt = extension_loaded('symfony_debug');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds casters for resources and objects.
|
||||
*
|
||||
* Maps resources or objects types to a callback.
|
||||
* Types are in the key, with a callable caster for value.
|
||||
* Resource types are to be prefixed with a `:`,
|
||||
* see e.g. static::$defaultCasters.
|
||||
*
|
||||
* @param callable[] $casters A map of casters
|
||||
*/
|
||||
public function addCasters(array $casters)
|
||||
{
|
||||
foreach ($casters as $type => $callback) {
|
||||
$this->casters[strtolower($type)][] = is_string($callback) && false !== strpos($callback, '::') ? explode('::', $callback, 2) : $callback;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum number of items to clone past the minimum depth in nested structures.
|
||||
*
|
||||
* @param int $maxItems
|
||||
*/
|
||||
public function setMaxItems($maxItems)
|
||||
{
|
||||
$this->maxItems = (int) $maxItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum cloned length for strings.
|
||||
*
|
||||
* @param int $maxString
|
||||
*/
|
||||
public function setMaxString($maxString)
|
||||
{
|
||||
$this->maxString = (int) $maxString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum tree depth where we are guaranteed to clone all the items. After this
|
||||
* depth is reached, only setMaxItems items will be cloned.
|
||||
*
|
||||
* @param int $minDepth
|
||||
*/
|
||||
public function setMinDepth($minDepth)
|
||||
{
|
||||
$this->minDepth = (int) $minDepth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clones a PHP variable.
|
||||
*
|
||||
* @param mixed $var Any PHP variable
|
||||
* @param int $filter A bit field of Caster::EXCLUDE_* constants
|
||||
*
|
||||
* @return Data The cloned variable represented by a Data object
|
||||
*/
|
||||
public function cloneVar($var, $filter = 0)
|
||||
{
|
||||
$this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = array()) {
|
||||
if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {
|
||||
// Cloner never dies
|
||||
throw new \ErrorException($msg, 0, $type, $file, $line);
|
||||
}
|
||||
|
||||
if ($this->prevErrorHandler) {
|
||||
return call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
$this->filter = $filter;
|
||||
|
||||
if ($gc = gc_enabled()) {
|
||||
gc_disable();
|
||||
}
|
||||
try {
|
||||
return new Data($this->doClone($var));
|
||||
} finally {
|
||||
if ($gc) {
|
||||
gc_enable();
|
||||
}
|
||||
restore_error_handler();
|
||||
$this->prevErrorHandler = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Effectively clones the PHP variable.
|
||||
*
|
||||
* @param mixed $var Any PHP variable
|
||||
*
|
||||
* @return array The cloned variable represented in an array
|
||||
*/
|
||||
abstract protected function doClone($var);
|
||||
|
||||
/**
|
||||
* Casts an object to an array representation.
|
||||
*
|
||||
* @param Stub $stub The Stub for the casted object
|
||||
* @param bool $isNested True if the object is nested in the dumped structure
|
||||
*
|
||||
* @return array The object casted as array
|
||||
*/
|
||||
protected function castObject(Stub $stub, $isNested)
|
||||
{
|
||||
$obj = $stub->value;
|
||||
$class = $stub->class;
|
||||
|
||||
if (isset($class[15]) && "\0" === $class[15] && 0 === strpos($class, "class@anonymous\x00")) {
|
||||
$stub->class = get_parent_class($class).'@anonymous';
|
||||
}
|
||||
if (isset($this->classInfo[$class])) {
|
||||
list($i, $parents, $hasDebugInfo) = $this->classInfo[$class];
|
||||
} else {
|
||||
$i = 2;
|
||||
$parents = array(strtolower($class));
|
||||
$hasDebugInfo = method_exists($class, '__debugInfo');
|
||||
|
||||
foreach (class_parents($class) as $p) {
|
||||
$parents[] = strtolower($p);
|
||||
++$i;
|
||||
}
|
||||
foreach (class_implements($class) as $p) {
|
||||
$parents[] = strtolower($p);
|
||||
++$i;
|
||||
}
|
||||
$parents[] = '*';
|
||||
|
||||
$this->classInfo[$class] = array($i, $parents, $hasDebugInfo);
|
||||
}
|
||||
|
||||
$a = Caster::castObject($obj, $class, $hasDebugInfo);
|
||||
|
||||
try {
|
||||
while ($i--) {
|
||||
if (!empty($this->casters[$p = $parents[$i]])) {
|
||||
foreach ($this->casters[$p] as $callback) {
|
||||
$a = $callback($obj, $a, $stub, $isNested, $this->filter);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$a = array((Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)) + $a;
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts a resource to an array representation.
|
||||
*
|
||||
* @param Stub $stub The Stub for the casted resource
|
||||
* @param bool $isNested True if the object is nested in the dumped structure
|
||||
*
|
||||
* @return array The resource casted as array
|
||||
*/
|
||||
protected function castResource(Stub $stub, $isNested)
|
||||
{
|
||||
$a = array();
|
||||
$res = $stub->value;
|
||||
$type = $stub->class;
|
||||
|
||||
try {
|
||||
if (!empty($this->casters[':'.$type])) {
|
||||
foreach ($this->casters[':'.$type] as $callback) {
|
||||
$a = $callback($res, $a, $stub, $isNested, $this->filter);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$a = array((Stub::TYPE_OBJECT === $stub->type ? Caster::PREFIX_VIRTUAL : '').'⚠' => new ThrowingCasterException($e)) + $a;
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
}
|
27
vendor/symfony/var-dumper/Cloner/ClonerInterface.php
vendored
Normal file
27
vendor/symfony/var-dumper/Cloner/ClonerInterface.php
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Cloner;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
interface ClonerInterface
|
||||
{
|
||||
/**
|
||||
* Clones a PHP variable.
|
||||
*
|
||||
* @param mixed $var Any PHP variable
|
||||
*
|
||||
* @return Data The cloned variable represented by a Data object
|
||||
*/
|
||||
public function cloneVar($var);
|
||||
}
|
43
vendor/symfony/var-dumper/Cloner/Cursor.php
vendored
Normal file
43
vendor/symfony/var-dumper/Cloner/Cursor.php
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Cloner;
|
||||
|
||||
/**
|
||||
* Represents the current state of a dumper while dumping.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class Cursor
|
||||
{
|
||||
const HASH_INDEXED = Stub::ARRAY_INDEXED;
|
||||
const HASH_ASSOC = Stub::ARRAY_ASSOC;
|
||||
const HASH_OBJECT = Stub::TYPE_OBJECT;
|
||||
const HASH_RESOURCE = Stub::TYPE_RESOURCE;
|
||||
|
||||
public $depth = 0;
|
||||
public $refIndex = 0;
|
||||
public $softRefTo = 0;
|
||||
public $softRefCount = 0;
|
||||
public $softRefHandle = 0;
|
||||
public $hardRefTo = 0;
|
||||
public $hardRefCount = 0;
|
||||
public $hardRefHandle = 0;
|
||||
public $hashType;
|
||||
public $hashKey;
|
||||
public $hashKeyIsBinary;
|
||||
public $hashIndex = 0;
|
||||
public $hashLength = 0;
|
||||
public $hashCut = 0;
|
||||
public $stop = false;
|
||||
public $attr = array();
|
||||
public $skipChildren = false;
|
||||
}
|
437
vendor/symfony/var-dumper/Cloner/Data.php
vendored
Normal file
437
vendor/symfony/var-dumper/Cloner/Data.php
vendored
Normal file
|
@ -0,0 +1,437 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Cloner;
|
||||
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class Data implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
{
|
||||
private $data;
|
||||
private $position = 0;
|
||||
private $key = 0;
|
||||
private $maxDepth = 20;
|
||||
private $maxItemsPerDepth = -1;
|
||||
private $useRefHandles = -1;
|
||||
|
||||
/**
|
||||
* @param array $data An array as returned by ClonerInterface::cloneVar()
|
||||
*/
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The type of the value
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
$item = $this->data[$this->position][$this->key];
|
||||
|
||||
if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
|
||||
$item = $item->value;
|
||||
}
|
||||
if (!$item instanceof Stub) {
|
||||
return gettype($item);
|
||||
}
|
||||
if (Stub::TYPE_STRING === $item->type) {
|
||||
return 'string';
|
||||
}
|
||||
if (Stub::TYPE_ARRAY === $item->type) {
|
||||
return 'array';
|
||||
}
|
||||
if (Stub::TYPE_OBJECT === $item->type) {
|
||||
return $item->class;
|
||||
}
|
||||
if (Stub::TYPE_RESOURCE === $item->type) {
|
||||
return $item->class.' resource';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $recursive Whether values should be resolved recursively or not
|
||||
*
|
||||
* @return scalar|array|null|Data[] A native representation of the original value
|
||||
*/
|
||||
public function getValue($recursive = false)
|
||||
{
|
||||
$item = $this->data[$this->position][$this->key];
|
||||
|
||||
if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
|
||||
$item = $item->value;
|
||||
}
|
||||
if (!($item = $this->getStub($item)) instanceof Stub) {
|
||||
return $item;
|
||||
}
|
||||
if (Stub::TYPE_STRING === $item->type) {
|
||||
return $item->value;
|
||||
}
|
||||
|
||||
$children = $item->position ? $this->data[$item->position] : array();
|
||||
|
||||
foreach ($children as $k => $v) {
|
||||
if ($recursive && !($v = $this->getStub($v)) instanceof Stub) {
|
||||
continue;
|
||||
}
|
||||
$children[$k] = clone $this;
|
||||
$children[$k]->key = $k;
|
||||
$children[$k]->position = $item->position;
|
||||
|
||||
if ($recursive) {
|
||||
if (Stub::TYPE_REF === $v->type && ($v = $this->getStub($v->value)) instanceof Stub) {
|
||||
$recursive = (array) $recursive;
|
||||
if (isset($recursive[$v->position])) {
|
||||
continue;
|
||||
}
|
||||
$recursive[$v->position] = true;
|
||||
}
|
||||
$children[$k] = $children[$k]->getValue($recursive);
|
||||
}
|
||||
}
|
||||
|
||||
return $children;
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
return count($this->getValue());
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
if (!is_array($value = $this->getValue())) {
|
||||
throw new \LogicException(sprintf('%s object holds non-iterable type "%s".', self::class, gettype($value)));
|
||||
}
|
||||
|
||||
foreach ($value as $k => $v) {
|
||||
yield $k => $v;
|
||||
}
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
{
|
||||
if (null !== $data = $this->seek($key)) {
|
||||
$item = $this->getStub($data->data[$data->position][$data->key]);
|
||||
|
||||
return $item instanceof Stub || array() === $item ? $data : $item;
|
||||
}
|
||||
}
|
||||
|
||||
public function __isset($key)
|
||||
{
|
||||
return null !== $this->seek($key);
|
||||
}
|
||||
|
||||
public function offsetExists($key)
|
||||
{
|
||||
return $this->__isset($key);
|
||||
}
|
||||
|
||||
public function offsetGet($key)
|
||||
{
|
||||
return $this->__get($key);
|
||||
}
|
||||
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
throw new \BadMethodCallException(self::class.' objects are immutable.');
|
||||
}
|
||||
|
||||
public function offsetUnset($key)
|
||||
{
|
||||
throw new \BadMethodCallException(self::class.' objects are immutable.');
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$value = $this->getValue();
|
||||
|
||||
if (!is_array($value)) {
|
||||
return (string) $value;
|
||||
}
|
||||
|
||||
return sprintf('%s (count=%d)', $this->getType(), count($value));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array The raw data structure
|
||||
*
|
||||
* @deprecated since version 3.3. Use array or object access instead.
|
||||
*/
|
||||
public function getRawData()
|
||||
{
|
||||
@trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the array or object access instead.', __METHOD__));
|
||||
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a depth limited clone of $this.
|
||||
*
|
||||
* @param int $maxDepth The max dumped depth level
|
||||
*
|
||||
* @return self A clone of $this
|
||||
*/
|
||||
public function withMaxDepth($maxDepth)
|
||||
{
|
||||
$data = clone $this;
|
||||
$data->maxDepth = (int) $maxDepth;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Limits the number of elements per depth level.
|
||||
*
|
||||
* @param int $maxItemsPerDepth The max number of items dumped per depth level
|
||||
*
|
||||
* @return self A clone of $this
|
||||
*/
|
||||
public function withMaxItemsPerDepth($maxItemsPerDepth)
|
||||
{
|
||||
$data = clone $this;
|
||||
$data->maxItemsPerDepth = (int) $maxItemsPerDepth;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/disables objects' identifiers tracking.
|
||||
*
|
||||
* @param bool $useRefHandles False to hide global ref. handles
|
||||
*
|
||||
* @return self A clone of $this
|
||||
*/
|
||||
public function withRefHandles($useRefHandles)
|
||||
{
|
||||
$data = clone $this;
|
||||
$data->useRefHandles = $useRefHandles ? -1 : 0;
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seeks to a specific key in nested data structures.
|
||||
*
|
||||
* @param string|int $key The key to seek to
|
||||
*
|
||||
* @return self|null A clone of $this of null if the key is not set
|
||||
*/
|
||||
public function seek($key)
|
||||
{
|
||||
$item = $this->data[$this->position][$this->key];
|
||||
|
||||
if ($item instanceof Stub && Stub::TYPE_REF === $item->type && !$item->position) {
|
||||
$item = $item->value;
|
||||
}
|
||||
if (!($item = $this->getStub($item)) instanceof Stub || !$item->position) {
|
||||
return;
|
||||
}
|
||||
$keys = array($key);
|
||||
|
||||
switch ($item->type) {
|
||||
case Stub::TYPE_OBJECT:
|
||||
$keys[] = Caster::PREFIX_DYNAMIC.$key;
|
||||
$keys[] = Caster::PREFIX_PROTECTED.$key;
|
||||
$keys[] = Caster::PREFIX_VIRTUAL.$key;
|
||||
$keys[] = "\0$item->class\0$key";
|
||||
// no break
|
||||
case Stub::TYPE_ARRAY:
|
||||
case Stub::TYPE_RESOURCE:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
$data = null;
|
||||
$children = $this->data[$item->position];
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if (isset($children[$key]) || array_key_exists($key, $children)) {
|
||||
$data = clone $this;
|
||||
$data->key = $key;
|
||||
$data->position = $item->position;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps data with a DumperInterface dumper.
|
||||
*/
|
||||
public function dump(DumperInterface $dumper)
|
||||
{
|
||||
$refs = array(0);
|
||||
$this->dumpItem($dumper, new Cursor(), $refs, $this->data[$this->position][$this->key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Depth-first dumping of items.
|
||||
*
|
||||
* @param DumperInterface $dumper The dumper being used for dumping
|
||||
* @param Cursor $cursor A cursor used for tracking dumper state position
|
||||
* @param array &$refs A map of all references discovered while dumping
|
||||
* @param mixed $item A Stub object or the original value being dumped
|
||||
*/
|
||||
private function dumpItem($dumper, $cursor, &$refs, $item)
|
||||
{
|
||||
$cursor->refIndex = 0;
|
||||
$cursor->softRefTo = $cursor->softRefHandle = $cursor->softRefCount = 0;
|
||||
$cursor->hardRefTo = $cursor->hardRefHandle = $cursor->hardRefCount = 0;
|
||||
$firstSeen = true;
|
||||
|
||||
if (!$item instanceof Stub) {
|
||||
$cursor->attr = array();
|
||||
$type = \gettype($item);
|
||||
if ($item && 'array' === $type) {
|
||||
$item = $this->getStub($item);
|
||||
}
|
||||
} elseif (Stub::TYPE_REF === $item->type) {
|
||||
if ($item->handle) {
|
||||
if (!isset($refs[$r = $item->handle - (PHP_INT_MAX >> 1)])) {
|
||||
$cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0];
|
||||
} else {
|
||||
$firstSeen = false;
|
||||
}
|
||||
$cursor->hardRefTo = $refs[$r];
|
||||
$cursor->hardRefHandle = $this->useRefHandles & $item->handle;
|
||||
$cursor->hardRefCount = $item->refCount;
|
||||
}
|
||||
$cursor->attr = $item->attr;
|
||||
$type = $item->class ?: gettype($item->value);
|
||||
$item = $this->getStub($item->value);
|
||||
}
|
||||
if ($item instanceof Stub) {
|
||||
if ($item->refCount) {
|
||||
if (!isset($refs[$r = $item->handle])) {
|
||||
$cursor->refIndex = $refs[$r] = $cursor->refIndex ?: ++$refs[0];
|
||||
} else {
|
||||
$firstSeen = false;
|
||||
}
|
||||
$cursor->softRefTo = $refs[$r];
|
||||
}
|
||||
$cursor->softRefHandle = $this->useRefHandles & $item->handle;
|
||||
$cursor->softRefCount = $item->refCount;
|
||||
$cursor->attr = $item->attr;
|
||||
$cut = $item->cut;
|
||||
|
||||
if ($item->position && $firstSeen) {
|
||||
$children = $this->data[$item->position];
|
||||
|
||||
if ($cursor->stop) {
|
||||
if ($cut >= 0) {
|
||||
$cut += count($children);
|
||||
}
|
||||
$children = array();
|
||||
}
|
||||
} else {
|
||||
$children = array();
|
||||
}
|
||||
switch ($item->type) {
|
||||
case Stub::TYPE_STRING:
|
||||
$dumper->dumpString($cursor, $item->value, Stub::STRING_BINARY === $item->class, $cut);
|
||||
break;
|
||||
|
||||
case Stub::TYPE_ARRAY:
|
||||
$item = clone $item;
|
||||
$item->type = $item->class;
|
||||
$item->class = $item->value;
|
||||
// no break
|
||||
case Stub::TYPE_OBJECT:
|
||||
case Stub::TYPE_RESOURCE:
|
||||
$withChildren = $children && $cursor->depth !== $this->maxDepth && $this->maxItemsPerDepth;
|
||||
$dumper->enterHash($cursor, $item->type, $item->class, $withChildren);
|
||||
if ($withChildren) {
|
||||
if ($cursor->skipChildren) {
|
||||
$withChildren = false;
|
||||
$cut = -1;
|
||||
} else {
|
||||
$cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type, null !== $item->class);
|
||||
}
|
||||
} elseif ($children && 0 <= $cut) {
|
||||
$cut += count($children);
|
||||
}
|
||||
$cursor->skipChildren = false;
|
||||
$dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new \RuntimeException(sprintf('Unexpected Stub type: %s', $item->type));
|
||||
}
|
||||
} elseif ('array' === $type) {
|
||||
$dumper->enterHash($cursor, Cursor::HASH_INDEXED, 0, false);
|
||||
$dumper->leaveHash($cursor, Cursor::HASH_INDEXED, 0, false, 0);
|
||||
} elseif ('string' === $type) {
|
||||
$dumper->dumpString($cursor, $item, false, 0);
|
||||
} else {
|
||||
$dumper->dumpScalar($cursor, $type, $item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps children of hash structures.
|
||||
*
|
||||
* @param DumperInterface $dumper
|
||||
* @param Cursor $parentCursor The cursor of the parent hash
|
||||
* @param array &$refs A map of all references discovered while dumping
|
||||
* @param array $children The children to dump
|
||||
* @param int $hashCut The number of items removed from the original hash
|
||||
* @param string $hashType A Cursor::HASH_* const
|
||||
* @param bool $dumpKeys Whether keys should be dumped or not
|
||||
*
|
||||
* @return int The final number of removed items
|
||||
*/
|
||||
private function dumpChildren($dumper, $parentCursor, &$refs, $children, $hashCut, $hashType, $dumpKeys)
|
||||
{
|
||||
$cursor = clone $parentCursor;
|
||||
++$cursor->depth;
|
||||
$cursor->hashType = $hashType;
|
||||
$cursor->hashIndex = 0;
|
||||
$cursor->hashLength = count($children);
|
||||
$cursor->hashCut = $hashCut;
|
||||
foreach ($children as $key => $child) {
|
||||
$cursor->hashKeyIsBinary = isset($key[0]) && !preg_match('//u', $key);
|
||||
$cursor->hashKey = $dumpKeys ? $key : null;
|
||||
$this->dumpItem($dumper, $cursor, $refs, $child);
|
||||
if (++$cursor->hashIndex === $this->maxItemsPerDepth || $cursor->stop) {
|
||||
$parentCursor->stop = true;
|
||||
|
||||
return $hashCut >= 0 ? $hashCut + $cursor->hashLength - $cursor->hashIndex : $hashCut;
|
||||
}
|
||||
}
|
||||
|
||||
return $hashCut;
|
||||
}
|
||||
|
||||
private function getStub($item)
|
||||
{
|
||||
if (!$item || !\is_array($item)) {
|
||||
return $item;
|
||||
}
|
||||
|
||||
$stub = new Stub();
|
||||
$stub->type = Stub::TYPE_ARRAY;
|
||||
foreach ($item as $stub->class => $stub->position) {
|
||||
}
|
||||
if (isset($item[0])) {
|
||||
$stub->cut = $item[0];
|
||||
}
|
||||
$stub->value = $stub->cut + ($stub->position ? \count($this->data[$stub->position]) : 0);
|
||||
|
||||
return $stub;
|
||||
}
|
||||
}
|
60
vendor/symfony/var-dumper/Cloner/DumperInterface.php
vendored
Normal file
60
vendor/symfony/var-dumper/Cloner/DumperInterface.php
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Cloner;
|
||||
|
||||
/**
|
||||
* DumperInterface used by Data objects.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
interface DumperInterface
|
||||
{
|
||||
/**
|
||||
* Dumps a scalar value.
|
||||
*
|
||||
* @param Cursor $cursor The Cursor position in the dump
|
||||
* @param string $type The PHP type of the value being dumped
|
||||
* @param scalar $value The scalar value being dumped
|
||||
*/
|
||||
public function dumpScalar(Cursor $cursor, $type, $value);
|
||||
|
||||
/**
|
||||
* Dumps a string.
|
||||
*
|
||||
* @param Cursor $cursor The Cursor position in the dump
|
||||
* @param string $str The string being dumped
|
||||
* @param bool $bin Whether $str is UTF-8 or binary encoded
|
||||
* @param int $cut The number of characters $str has been cut by
|
||||
*/
|
||||
public function dumpString(Cursor $cursor, $str, $bin, $cut);
|
||||
|
||||
/**
|
||||
* Dumps while entering an hash.
|
||||
*
|
||||
* @param Cursor $cursor The Cursor position in the dump
|
||||
* @param int $type A Cursor::HASH_* const for the type of hash
|
||||
* @param string $class The object class, resource type or array count
|
||||
* @param bool $hasChild When the dump of the hash has child item
|
||||
*/
|
||||
public function enterHash(Cursor $cursor, $type, $class, $hasChild);
|
||||
|
||||
/**
|
||||
* Dumps while leaving an hash.
|
||||
*
|
||||
* @param Cursor $cursor The Cursor position in the dump
|
||||
* @param int $type A Cursor::HASH_* const for the type of hash
|
||||
* @param string $class The object class, resource type or array count
|
||||
* @param bool $hasChild When the dump of the hash has child item
|
||||
* @param int $cut The number of items the hash has been cut by
|
||||
*/
|
||||
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut);
|
||||
}
|
57
vendor/symfony/var-dumper/Cloner/Stub.php
vendored
Normal file
57
vendor/symfony/var-dumper/Cloner/Stub.php
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Cloner;
|
||||
|
||||
/**
|
||||
* Represents the main properties of a PHP variable.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class Stub implements \Serializable
|
||||
{
|
||||
const TYPE_REF = 1;
|
||||
const TYPE_STRING = 2;
|
||||
const TYPE_ARRAY = 3;
|
||||
const TYPE_OBJECT = 4;
|
||||
const TYPE_RESOURCE = 5;
|
||||
|
||||
const STRING_BINARY = 1;
|
||||
const STRING_UTF8 = 2;
|
||||
|
||||
const ARRAY_ASSOC = 1;
|
||||
const ARRAY_INDEXED = 2;
|
||||
|
||||
public $type = self::TYPE_REF;
|
||||
public $class = '';
|
||||
public $value;
|
||||
public $cut = 0;
|
||||
public $handle = 0;
|
||||
public $refCount = 0;
|
||||
public $position = 0;
|
||||
public $attr = array();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
return \serialize(array($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr));
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function unserialize($serialized)
|
||||
{
|
||||
list($this->class, $this->position, $this->cut, $this->type, $this->value, $this->handle, $this->refCount, $this->attr) = \unserialize($serialized);
|
||||
}
|
||||
}
|
327
vendor/symfony/var-dumper/Cloner/VarCloner.php
vendored
Normal file
327
vendor/symfony/var-dumper/Cloner/VarCloner.php
vendored
Normal file
|
@ -0,0 +1,327 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Cloner;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class VarCloner extends AbstractCloner
|
||||
{
|
||||
private static $gid;
|
||||
private static $hashMask = 0;
|
||||
private static $hashOffset = 0;
|
||||
private static $arrayCache = array();
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doClone($var)
|
||||
{
|
||||
$len = 1; // Length of $queue
|
||||
$pos = 0; // Number of cloned items past the minimum depth
|
||||
$refsCounter = 0; // Hard references counter
|
||||
$queue = array(array($var)); // This breadth-first queue is the return value
|
||||
$indexedArrays = array(); // Map of queue indexes that hold numerically indexed arrays
|
||||
$hardRefs = array(); // Map of original zval hashes to stub objects
|
||||
$objRefs = array(); // Map of original object handles to their stub object couterpart
|
||||
$resRefs = array(); // Map of original resource handles to their stub object couterpart
|
||||
$values = array(); // Map of stub objects' hashes to original values
|
||||
$maxItems = $this->maxItems;
|
||||
$maxString = $this->maxString;
|
||||
$minDepth = $this->minDepth;
|
||||
$currentDepth = 0; // Current tree depth
|
||||
$currentDepthFinalIndex = 0; // Final $queue index for current tree depth
|
||||
$minimumDepthReached = 0 === $minDepth; // Becomes true when minimum tree depth has been reached
|
||||
$cookie = (object) array(); // Unique object used to detect hard references
|
||||
$a = null; // Array cast for nested structures
|
||||
$stub = null; // Stub capturing the main properties of an original item value
|
||||
// or null if the original value is used directly
|
||||
|
||||
if (!self::$hashMask) {
|
||||
self::$gid = uniqid(mt_rand(), true); // Unique string used to detect the special $GLOBALS variable
|
||||
self::initHashMask();
|
||||
}
|
||||
$gid = self::$gid;
|
||||
$hashMask = self::$hashMask;
|
||||
$hashOffset = self::$hashOffset;
|
||||
$arrayStub = new Stub();
|
||||
$arrayStub->type = Stub::TYPE_ARRAY;
|
||||
$fromObjCast = false;
|
||||
|
||||
for ($i = 0; $i < $len; ++$i) {
|
||||
// Detect when we move on to the next tree depth
|
||||
if ($i > $currentDepthFinalIndex) {
|
||||
++$currentDepth;
|
||||
$currentDepthFinalIndex = $len - 1;
|
||||
if ($currentDepth >= $minDepth) {
|
||||
$minimumDepthReached = true;
|
||||
}
|
||||
}
|
||||
|
||||
$refs = $vals = $queue[$i];
|
||||
if (\PHP_VERSION_ID < 70200 && empty($indexedArrays[$i])) {
|
||||
// see https://wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts
|
||||
foreach ($vals as $k => $v) {
|
||||
if (\is_int($k)) {
|
||||
continue;
|
||||
}
|
||||
foreach (array($k => true) as $gk => $gv) {
|
||||
}
|
||||
if ($gk !== $k) {
|
||||
$fromObjCast = true;
|
||||
$refs = $vals = \array_values($queue[$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($vals as $k => $v) {
|
||||
// $v is the original value or a stub object in case of hard references
|
||||
$refs[$k] = $cookie;
|
||||
if ($zvalIsRef = $vals[$k] === $cookie) {
|
||||
$vals[$k] = &$stub; // Break hard references to make $queue completely
|
||||
unset($stub); // independent from the original structure
|
||||
if ($v instanceof Stub && isset($hardRefs[\spl_object_hash($v)])) {
|
||||
$vals[$k] = $refs[$k] = $v;
|
||||
if ($v->value instanceof Stub && (Stub::TYPE_OBJECT === $v->value->type || Stub::TYPE_RESOURCE === $v->value->type)) {
|
||||
++$v->value->refCount;
|
||||
}
|
||||
++$v->refCount;
|
||||
continue;
|
||||
}
|
||||
$refs[$k] = $vals[$k] = new Stub();
|
||||
$refs[$k]->value = $v;
|
||||
$h = \spl_object_hash($refs[$k]);
|
||||
$hardRefs[$h] = &$refs[$k];
|
||||
$values[$h] = $v;
|
||||
$vals[$k]->handle = ++$refsCounter;
|
||||
}
|
||||
// Create $stub when the original value $v can not be used directly
|
||||
// If $v is a nested structure, put that structure in array $a
|
||||
switch (true) {
|
||||
case null === $v:
|
||||
case \is_bool($v):
|
||||
case \is_int($v):
|
||||
case \is_float($v):
|
||||
continue 2;
|
||||
|
||||
case \is_string($v):
|
||||
if ('' === $v) {
|
||||
continue 2;
|
||||
}
|
||||
if (!\preg_match('//u', $v)) {
|
||||
$stub = new Stub();
|
||||
$stub->type = Stub::TYPE_STRING;
|
||||
$stub->class = Stub::STRING_BINARY;
|
||||
if (0 <= $maxString && 0 < $cut = \strlen($v) - $maxString) {
|
||||
$stub->cut = $cut;
|
||||
$stub->value = \substr($v, 0, -$cut);
|
||||
} else {
|
||||
$stub->value = $v;
|
||||
}
|
||||
} elseif (0 <= $maxString && isset($v[1 + ($maxString >> 2)]) && 0 < $cut = \mb_strlen($v, 'UTF-8') - $maxString) {
|
||||
$stub = new Stub();
|
||||
$stub->type = Stub::TYPE_STRING;
|
||||
$stub->class = Stub::STRING_UTF8;
|
||||
$stub->cut = $cut;
|
||||
$stub->value = \mb_substr($v, 0, $maxString, 'UTF-8');
|
||||
} else {
|
||||
continue 2;
|
||||
}
|
||||
$a = null;
|
||||
break;
|
||||
|
||||
case \is_array($v):
|
||||
if (!$v) {
|
||||
continue 2;
|
||||
}
|
||||
$stub = $arrayStub;
|
||||
$stub->class = Stub::ARRAY_INDEXED;
|
||||
|
||||
$j = -1;
|
||||
foreach ($v as $gk => $gv) {
|
||||
if ($gk !== ++$j) {
|
||||
$stub->class = Stub::ARRAY_ASSOC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$a = $v;
|
||||
|
||||
if (Stub::ARRAY_ASSOC === $stub->class) {
|
||||
// Copies of $GLOBALS have very strange behavior,
|
||||
// let's detect them with some black magic
|
||||
$a[$gid] = true;
|
||||
|
||||
// Happens with copies of $GLOBALS
|
||||
if (isset($v[$gid])) {
|
||||
unset($v[$gid]);
|
||||
$a = array();
|
||||
foreach ($v as $gk => &$gv) {
|
||||
$a[$gk] = &$gv;
|
||||
}
|
||||
unset($gv);
|
||||
} else {
|
||||
$a = $v;
|
||||
}
|
||||
} elseif (\PHP_VERSION_ID < 70200) {
|
||||
$indexedArrays[$len] = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case \is_object($v):
|
||||
case $v instanceof \__PHP_Incomplete_Class:
|
||||
if (empty($objRefs[$h = $hashMask ^ \hexdec(\substr(\spl_object_hash($v), $hashOffset, \PHP_INT_SIZE))])) {
|
||||
$stub = new Stub();
|
||||
$stub->type = Stub::TYPE_OBJECT;
|
||||
$stub->class = \get_class($v);
|
||||
$stub->value = $v;
|
||||
$stub->handle = $h;
|
||||
$a = $this->castObject($stub, 0 < $i);
|
||||
if ($v !== $stub->value) {
|
||||
if (Stub::TYPE_OBJECT !== $stub->type || null === $stub->value) {
|
||||
break;
|
||||
}
|
||||
$h = $hashMask ^ \hexdec(\substr(\spl_object_hash($stub->value), $hashOffset, \PHP_INT_SIZE));
|
||||
$stub->handle = $h;
|
||||
}
|
||||
$stub->value = null;
|
||||
if (0 <= $maxItems && $maxItems <= $pos && $minimumDepthReached) {
|
||||
$stub->cut = \count($a);
|
||||
$a = null;
|
||||
}
|
||||
}
|
||||
if (empty($objRefs[$h])) {
|
||||
$objRefs[$h] = $stub;
|
||||
} else {
|
||||
$stub = $objRefs[$h];
|
||||
++$stub->refCount;
|
||||
$a = null;
|
||||
}
|
||||
break;
|
||||
|
||||
default: // resource
|
||||
if (empty($resRefs[$h = (int) $v])) {
|
||||
$stub = new Stub();
|
||||
$stub->type = Stub::TYPE_RESOURCE;
|
||||
if ('Unknown' === $stub->class = @\get_resource_type($v)) {
|
||||
$stub->class = 'Closed';
|
||||
}
|
||||
$stub->value = $v;
|
||||
$stub->handle = $h;
|
||||
$a = $this->castResource($stub, 0 < $i);
|
||||
$stub->value = null;
|
||||
if (0 <= $maxItems && $maxItems <= $pos && $minimumDepthReached) {
|
||||
$stub->cut = \count($a);
|
||||
$a = null;
|
||||
}
|
||||
}
|
||||
if (empty($resRefs[$h])) {
|
||||
$resRefs[$h] = $stub;
|
||||
} else {
|
||||
$stub = $resRefs[$h];
|
||||
++$stub->refCount;
|
||||
$a = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($a) {
|
||||
if (!$minimumDepthReached || 0 > $maxItems) {
|
||||
$queue[$len] = $a;
|
||||
$stub->position = $len++;
|
||||
} elseif ($pos < $maxItems) {
|
||||
if ($maxItems < $pos += \count($a)) {
|
||||
$a = \array_slice($a, 0, $maxItems - $pos);
|
||||
if ($stub->cut >= 0) {
|
||||
$stub->cut += $pos - $maxItems;
|
||||
}
|
||||
}
|
||||
$queue[$len] = $a;
|
||||
$stub->position = $len++;
|
||||
} elseif ($stub->cut >= 0) {
|
||||
$stub->cut += \count($a);
|
||||
$stub->position = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ($arrayStub === $stub) {
|
||||
if ($arrayStub->cut) {
|
||||
$stub = array($arrayStub->cut, $arrayStub->class => $arrayStub->position);
|
||||
$arrayStub->cut = 0;
|
||||
} elseif (isset(self::$arrayCache[$arrayStub->class][$arrayStub->position])) {
|
||||
$stub = self::$arrayCache[$arrayStub->class][$arrayStub->position];
|
||||
} else {
|
||||
self::$arrayCache[$arrayStub->class][$arrayStub->position] = $stub = array($arrayStub->class => $arrayStub->position);
|
||||
}
|
||||
}
|
||||
|
||||
if ($zvalIsRef) {
|
||||
$refs[$k]->value = $stub;
|
||||
} else {
|
||||
$vals[$k] = $stub;
|
||||
}
|
||||
}
|
||||
|
||||
if ($fromObjCast) {
|
||||
$fromObjCast = false;
|
||||
$refs = $vals;
|
||||
$vals = array();
|
||||
$j = -1;
|
||||
foreach ($queue[$i] as $k => $v) {
|
||||
foreach (array($k => true) as $gk => $gv) {
|
||||
}
|
||||
if ($gk !== $k) {
|
||||
$vals = (object) $vals;
|
||||
$vals->{$k} = $refs[++$j];
|
||||
$vals = (array) $vals;
|
||||
} else {
|
||||
$vals[$k] = $refs[++$j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$queue[$i] = $vals;
|
||||
}
|
||||
|
||||
foreach ($values as $h => $v) {
|
||||
$hardRefs[$h] = $v;
|
||||
}
|
||||
|
||||
return $queue;
|
||||
}
|
||||
|
||||
private static function initHashMask()
|
||||
{
|
||||
$obj = (object) array();
|
||||
self::$hashOffset = 16 - PHP_INT_SIZE;
|
||||
self::$hashMask = -1;
|
||||
|
||||
if (defined('HHVM_VERSION')) {
|
||||
self::$hashOffset += 16;
|
||||
} else {
|
||||
// check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below
|
||||
$obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush');
|
||||
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) {
|
||||
if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) {
|
||||
$frame['line'] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!empty($frame['line'])) {
|
||||
ob_start();
|
||||
debug_zval_dump($obj);
|
||||
self::$hashMask = (int) substr(ob_get_clean(), 17);
|
||||
}
|
||||
}
|
||||
|
||||
self::$hashMask ^= hexdec(substr(spl_object_hash($obj), self::$hashOffset, PHP_INT_SIZE));
|
||||
}
|
||||
}
|
211
vendor/symfony/var-dumper/Dumper/AbstractDumper.php
vendored
Normal file
211
vendor/symfony/var-dumper/Dumper/AbstractDumper.php
vendored
Normal file
|
@ -0,0 +1,211 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Dumper;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
use Symfony\Component\VarDumper\Cloner\DumperInterface;
|
||||
|
||||
/**
|
||||
* Abstract mechanism for dumping a Data object.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
abstract class AbstractDumper implements DataDumperInterface, DumperInterface
|
||||
{
|
||||
const DUMP_LIGHT_ARRAY = 1;
|
||||
const DUMP_STRING_LENGTH = 2;
|
||||
const DUMP_COMMA_SEPARATOR = 4;
|
||||
const DUMP_TRAILING_COMMA = 8;
|
||||
|
||||
public static $defaultOutput = 'php://output';
|
||||
|
||||
protected $line = '';
|
||||
protected $lineDumper;
|
||||
protected $outputStream;
|
||||
protected $decimalPoint; // This is locale dependent
|
||||
protected $indentPad = ' ';
|
||||
protected $flags;
|
||||
|
||||
private $charset;
|
||||
|
||||
/**
|
||||
* @param callable|resource|string|null $output A line dumper callable, an opened stream or an output path, defaults to static::$defaultOutput
|
||||
* @param string $charset The default character encoding to use for non-UTF8 strings
|
||||
* @param int $flags A bit field of static::DUMP_* constants to fine tune dumps representation
|
||||
*/
|
||||
public function __construct($output = null, $charset = null, $flags = 0)
|
||||
{
|
||||
$this->flags = (int) $flags;
|
||||
$this->setCharset($charset ?: ini_get('php.output_encoding') ?: ini_get('default_charset') ?: 'UTF-8');
|
||||
$this->decimalPoint = localeconv();
|
||||
$this->decimalPoint = $this->decimalPoint['decimal_point'];
|
||||
$this->setOutput($output ?: static::$defaultOutput);
|
||||
if (!$output && is_string(static::$defaultOutput)) {
|
||||
static::$defaultOutput = $this->outputStream;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the output destination of the dumps.
|
||||
*
|
||||
* @param callable|resource|string $output A line dumper callable, an opened stream or an output path
|
||||
*
|
||||
* @return callable|resource|string The previous output destination
|
||||
*/
|
||||
public function setOutput($output)
|
||||
{
|
||||
$prev = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;
|
||||
|
||||
if (is_callable($output)) {
|
||||
$this->outputStream = null;
|
||||
$this->lineDumper = $output;
|
||||
} else {
|
||||
if (is_string($output)) {
|
||||
$output = fopen($output, 'wb');
|
||||
}
|
||||
$this->outputStream = $output;
|
||||
$this->lineDumper = array($this, 'echoLine');
|
||||
}
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default character encoding to use for non-UTF8 strings.
|
||||
*
|
||||
* @param string $charset The default character encoding to use for non-UTF8 strings
|
||||
*
|
||||
* @return string The previous charset
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
{
|
||||
$prev = $this->charset;
|
||||
|
||||
$charset = strtoupper($charset);
|
||||
$charset = null === $charset || 'UTF-8' === $charset || 'UTF8' === $charset ? 'CP1252' : $charset;
|
||||
|
||||
$this->charset = $charset;
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the indentation pad string.
|
||||
*
|
||||
* @param string $pad A string the will be prepended to dumped lines, repeated by nesting level
|
||||
*
|
||||
* @return string The indent pad
|
||||
*/
|
||||
public function setIndentPad($pad)
|
||||
{
|
||||
$prev = $this->indentPad;
|
||||
$this->indentPad = $pad;
|
||||
|
||||
return $prev;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps a Data object.
|
||||
*
|
||||
* @param Data $data A Data object
|
||||
* @param callable|resource|string|true|null $output A line dumper callable, an opened stream, an output path or true to return the dump
|
||||
*
|
||||
* @return string|null The dump as string when $output is true
|
||||
*/
|
||||
public function dump(Data $data, $output = null)
|
||||
{
|
||||
$this->decimalPoint = localeconv();
|
||||
$this->decimalPoint = $this->decimalPoint['decimal_point'];
|
||||
|
||||
if ($locale = $this->flags & (self::DUMP_COMMA_SEPARATOR | self::DUMP_TRAILING_COMMA) ? setlocale(LC_NUMERIC, 0) : null) {
|
||||
setlocale(LC_NUMERIC, 'C');
|
||||
}
|
||||
|
||||
if ($returnDump = true === $output) {
|
||||
$output = fopen('php://memory', 'r+b');
|
||||
}
|
||||
if ($output) {
|
||||
$prevOutput = $this->setOutput($output);
|
||||
}
|
||||
try {
|
||||
$data->dump($this);
|
||||
$this->dumpLine(-1);
|
||||
|
||||
if ($returnDump) {
|
||||
$result = stream_get_contents($output, -1, 0);
|
||||
fclose($output);
|
||||
|
||||
return $result;
|
||||
}
|
||||
} finally {
|
||||
if ($output) {
|
||||
$this->setOutput($prevOutput);
|
||||
}
|
||||
if ($locale) {
|
||||
setlocale(LC_NUMERIC, $locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps the current line.
|
||||
*
|
||||
* @param int $depth The recursive depth in the dumped structure for the line being dumped,
|
||||
* or -1 to signal the end-of-dump to the line dumper callable
|
||||
*/
|
||||
protected function dumpLine($depth)
|
||||
{
|
||||
call_user_func($this->lineDumper, $this->line, $depth, $this->indentPad);
|
||||
$this->line = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic line dumper callback.
|
||||
*
|
||||
* @param string $line The line to write
|
||||
* @param int $depth The recursive depth in the dumped structure
|
||||
* @param string $indentPad The line indent pad
|
||||
*/
|
||||
protected function echoLine($line, $depth, $indentPad)
|
||||
{
|
||||
if (-1 !== $depth) {
|
||||
fwrite($this->outputStream, str_repeat($indentPad, $depth).$line."\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a non-UTF-8 string to UTF-8.
|
||||
*
|
||||
* @param string $s The non-UTF-8 string to convert
|
||||
*
|
||||
* @return string The string converted to UTF-8
|
||||
*/
|
||||
protected function utf8Encode($s)
|
||||
{
|
||||
if (preg_match('//u', $s)) {
|
||||
return $s;
|
||||
}
|
||||
|
||||
if (!function_exists('iconv')) {
|
||||
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.');
|
||||
}
|
||||
|
||||
if (false !== $c = @iconv($this->charset, 'UTF-8', $s)) {
|
||||
return $c;
|
||||
}
|
||||
if ('CP1252' !== $this->charset && false !== $c = @iconv('CP1252', 'UTF-8', $s)) {
|
||||
return $c;
|
||||
}
|
||||
|
||||
return iconv('CP850', 'UTF-8', $s);
|
||||
}
|
||||
}
|
539
vendor/symfony/var-dumper/Dumper/CliDumper.php
vendored
Normal file
539
vendor/symfony/var-dumper/Dumper/CliDumper.php
vendored
Normal file
|
@ -0,0 +1,539 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Dumper;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Cursor;
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
|
||||
/**
|
||||
* CliDumper dumps variables for command line output.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class CliDumper extends AbstractDumper
|
||||
{
|
||||
public static $defaultColors;
|
||||
public static $defaultOutput = 'php://stdout';
|
||||
|
||||
protected $colors;
|
||||
protected $maxStringWidth = 0;
|
||||
protected $styles = array(
|
||||
// See http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
||||
'default' => '38;5;208',
|
||||
'num' => '1;38;5;38',
|
||||
'const' => '1;38;5;208',
|
||||
'str' => '1;38;5;113',
|
||||
'note' => '38;5;38',
|
||||
'ref' => '38;5;247',
|
||||
'public' => '',
|
||||
'protected' => '',
|
||||
'private' => '',
|
||||
'meta' => '38;5;170',
|
||||
'key' => '38;5;113',
|
||||
'index' => '38;5;38',
|
||||
);
|
||||
|
||||
protected static $controlCharsRx = '/[\x00-\x1F\x7F]+/';
|
||||
protected static $controlCharsMap = array(
|
||||
"\t" => '\t',
|
||||
"\n" => '\n',
|
||||
"\v" => '\v',
|
||||
"\f" => '\f',
|
||||
"\r" => '\r',
|
||||
"\033" => '\e',
|
||||
);
|
||||
|
||||
protected $collapseNextHash = false;
|
||||
protected $expandNextHash = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct($output = null, $charset = null, $flags = 0)
|
||||
{
|
||||
parent::__construct($output, $charset, $flags);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR && 'ON' !== @getenv('ConEmuANSI') && 'xterm' !== @getenv('TERM')) {
|
||||
// Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI
|
||||
$this->setStyles(array(
|
||||
'default' => '31',
|
||||
'num' => '1;34',
|
||||
'const' => '1;31',
|
||||
'str' => '1;32',
|
||||
'note' => '34',
|
||||
'ref' => '1;30',
|
||||
'meta' => '35',
|
||||
'key' => '32',
|
||||
'index' => '34',
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/disables colored output.
|
||||
*
|
||||
* @param bool $colors
|
||||
*/
|
||||
public function setColors($colors)
|
||||
{
|
||||
$this->colors = (bool) $colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum number of characters per line for dumped strings.
|
||||
*
|
||||
* @param int $maxStringWidth
|
||||
*/
|
||||
public function setMaxStringWidth($maxStringWidth)
|
||||
{
|
||||
$this->maxStringWidth = (int) $maxStringWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures styles.
|
||||
*
|
||||
* @param array $styles A map of style names to style definitions
|
||||
*/
|
||||
public function setStyles(array $styles)
|
||||
{
|
||||
$this->styles = $styles + $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dumpScalar(Cursor $cursor, $type, $value)
|
||||
{
|
||||
$this->dumpKey($cursor);
|
||||
|
||||
$style = 'const';
|
||||
$attr = $cursor->attr;
|
||||
|
||||
switch ($type) {
|
||||
case 'default':
|
||||
$style = 'default';
|
||||
break;
|
||||
|
||||
case 'integer':
|
||||
$style = 'num';
|
||||
break;
|
||||
|
||||
case 'double':
|
||||
$style = 'num';
|
||||
|
||||
switch (true) {
|
||||
case INF === $value: $value = 'INF'; break;
|
||||
case -INF === $value: $value = '-INF'; break;
|
||||
case is_nan($value): $value = 'NAN'; break;
|
||||
default:
|
||||
$value = (string) $value;
|
||||
if (false === strpos($value, $this->decimalPoint)) {
|
||||
$value .= $this->decimalPoint.'0';
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'NULL':
|
||||
$value = 'null';
|
||||
break;
|
||||
|
||||
case 'boolean':
|
||||
$value = $value ? 'true' : 'false';
|
||||
break;
|
||||
|
||||
default:
|
||||
$attr += array('value' => $this->utf8Encode($value));
|
||||
$value = $this->utf8Encode($type);
|
||||
break;
|
||||
}
|
||||
|
||||
$this->line .= $this->style($style, $value, $attr);
|
||||
|
||||
$this->endValue($cursor);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dumpString(Cursor $cursor, $str, $bin, $cut)
|
||||
{
|
||||
$this->dumpKey($cursor);
|
||||
$attr = $cursor->attr;
|
||||
|
||||
if ($bin) {
|
||||
$str = $this->utf8Encode($str);
|
||||
}
|
||||
if ('' === $str) {
|
||||
$this->line .= '""';
|
||||
$this->endValue($cursor);
|
||||
} else {
|
||||
$attr += array(
|
||||
'length' => 0 <= $cut ? mb_strlen($str, 'UTF-8') + $cut : 0,
|
||||
'binary' => $bin,
|
||||
);
|
||||
$str = explode("\n", $str);
|
||||
if (isset($str[1]) && !isset($str[2]) && !isset($str[1][0])) {
|
||||
unset($str[1]);
|
||||
$str[0] .= "\n";
|
||||
}
|
||||
$m = count($str) - 1;
|
||||
$i = $lineCut = 0;
|
||||
|
||||
if (self::DUMP_STRING_LENGTH & $this->flags) {
|
||||
$this->line .= '('.$attr['length'].') ';
|
||||
}
|
||||
if ($bin) {
|
||||
$this->line .= 'b';
|
||||
}
|
||||
|
||||
if ($m) {
|
||||
$this->line .= '"""';
|
||||
$this->dumpLine($cursor->depth);
|
||||
} else {
|
||||
$this->line .= '"';
|
||||
}
|
||||
|
||||
foreach ($str as $str) {
|
||||
if ($i < $m) {
|
||||
$str .= "\n";
|
||||
}
|
||||
if (0 < $this->maxStringWidth && $this->maxStringWidth < $len = mb_strlen($str, 'UTF-8')) {
|
||||
$str = mb_substr($str, 0, $this->maxStringWidth, 'UTF-8');
|
||||
$lineCut = $len - $this->maxStringWidth;
|
||||
}
|
||||
if ($m && 0 < $cursor->depth) {
|
||||
$this->line .= $this->indentPad;
|
||||
}
|
||||
if ('' !== $str) {
|
||||
$this->line .= $this->style('str', $str, $attr);
|
||||
}
|
||||
if ($i++ == $m) {
|
||||
if ($m) {
|
||||
if ('' !== $str) {
|
||||
$this->dumpLine($cursor->depth);
|
||||
if (0 < $cursor->depth) {
|
||||
$this->line .= $this->indentPad;
|
||||
}
|
||||
}
|
||||
$this->line .= '"""';
|
||||
} else {
|
||||
$this->line .= '"';
|
||||
}
|
||||
if ($cut < 0) {
|
||||
$this->line .= '…';
|
||||
$lineCut = 0;
|
||||
} elseif ($cut) {
|
||||
$lineCut += $cut;
|
||||
}
|
||||
}
|
||||
if ($lineCut) {
|
||||
$this->line .= '…'.$lineCut;
|
||||
$lineCut = 0;
|
||||
}
|
||||
|
||||
if ($i > $m) {
|
||||
$this->endValue($cursor);
|
||||
} else {
|
||||
$this->dumpLine($cursor->depth);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
|
||||
{
|
||||
$this->dumpKey($cursor);
|
||||
|
||||
if ($this->collapseNextHash) {
|
||||
$cursor->skipChildren = true;
|
||||
$this->collapseNextHash = $hasChild = false;
|
||||
}
|
||||
|
||||
$class = $this->utf8Encode($class);
|
||||
if (Cursor::HASH_OBJECT === $type) {
|
||||
$prefix = $class && 'stdClass' !== $class ? $this->style('note', $class).' {' : '{';
|
||||
} elseif (Cursor::HASH_RESOURCE === $type) {
|
||||
$prefix = $this->style('note', $class.' resource').($hasChild ? ' {' : ' ');
|
||||
} else {
|
||||
$prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:'.$class).' [' : '[';
|
||||
}
|
||||
|
||||
if ($cursor->softRefCount || 0 < $cursor->softRefHandle) {
|
||||
$prefix .= $this->style('ref', (Cursor::HASH_RESOURCE === $type ? '@' : '#').(0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->softRefTo), array('count' => $cursor->softRefCount));
|
||||
} elseif ($cursor->hardRefTo && !$cursor->refIndex && $class) {
|
||||
$prefix .= $this->style('ref', '&'.$cursor->hardRefTo, array('count' => $cursor->hardRefCount));
|
||||
} elseif (!$hasChild && Cursor::HASH_RESOURCE === $type) {
|
||||
$prefix = substr($prefix, 0, -1);
|
||||
}
|
||||
|
||||
$this->line .= $prefix;
|
||||
|
||||
if ($hasChild) {
|
||||
$this->dumpLine($cursor->depth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
|
||||
{
|
||||
$this->dumpEllipsis($cursor, $hasChild, $cut);
|
||||
$this->line .= Cursor::HASH_OBJECT === $type ? '}' : (Cursor::HASH_RESOURCE !== $type ? ']' : ($hasChild ? '}' : ''));
|
||||
$this->endValue($cursor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps an ellipsis for cut children.
|
||||
*
|
||||
* @param Cursor $cursor The Cursor position in the dump
|
||||
* @param bool $hasChild When the dump of the hash has child item
|
||||
* @param int $cut The number of items the hash has been cut by
|
||||
*/
|
||||
protected function dumpEllipsis(Cursor $cursor, $hasChild, $cut)
|
||||
{
|
||||
if ($cut) {
|
||||
$this->line .= ' …';
|
||||
if (0 < $cut) {
|
||||
$this->line .= $cut;
|
||||
}
|
||||
if ($hasChild) {
|
||||
$this->dumpLine($cursor->depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps a key in a hash structure.
|
||||
*
|
||||
* @param Cursor $cursor The Cursor position in the dump
|
||||
*/
|
||||
protected function dumpKey(Cursor $cursor)
|
||||
{
|
||||
if (null !== $key = $cursor->hashKey) {
|
||||
if ($cursor->hashKeyIsBinary) {
|
||||
$key = $this->utf8Encode($key);
|
||||
}
|
||||
$attr = array('binary' => $cursor->hashKeyIsBinary);
|
||||
$bin = $cursor->hashKeyIsBinary ? 'b' : '';
|
||||
$style = 'key';
|
||||
switch ($cursor->hashType) {
|
||||
default:
|
||||
case Cursor::HASH_INDEXED:
|
||||
if (self::DUMP_LIGHT_ARRAY & $this->flags) {
|
||||
break;
|
||||
}
|
||||
$style = 'index';
|
||||
// no break
|
||||
case Cursor::HASH_ASSOC:
|
||||
if (is_int($key)) {
|
||||
$this->line .= $this->style($style, $key).' => ';
|
||||
} else {
|
||||
$this->line .= $bin.'"'.$this->style($style, $key).'" => ';
|
||||
}
|
||||
break;
|
||||
|
||||
case Cursor::HASH_RESOURCE:
|
||||
$key = "\0~\0".$key;
|
||||
// no break
|
||||
case Cursor::HASH_OBJECT:
|
||||
if (!isset($key[0]) || "\0" !== $key[0]) {
|
||||
$this->line .= '+'.$bin.$this->style('public', $key).': ';
|
||||
} elseif (0 < strpos($key, "\0", 1)) {
|
||||
$key = explode("\0", substr($key, 1), 2);
|
||||
|
||||
switch ($key[0][0]) {
|
||||
case '+': // User inserted keys
|
||||
$attr['dynamic'] = true;
|
||||
$this->line .= '+'.$bin.'"'.$this->style('public', $key[1], $attr).'": ';
|
||||
break 2;
|
||||
case '~':
|
||||
$style = 'meta';
|
||||
if (isset($key[0][1])) {
|
||||
parse_str(substr($key[0], 1), $attr);
|
||||
$attr += array('binary' => $cursor->hashKeyIsBinary);
|
||||
}
|
||||
break;
|
||||
case '*':
|
||||
$style = 'protected';
|
||||
$bin = '#'.$bin;
|
||||
break;
|
||||
default:
|
||||
$attr['class'] = $key[0];
|
||||
$style = 'private';
|
||||
$bin = '-'.$bin;
|
||||
break;
|
||||
}
|
||||
|
||||
if (isset($attr['collapse'])) {
|
||||
if ($attr['collapse']) {
|
||||
$this->collapseNextHash = true;
|
||||
} else {
|
||||
$this->expandNextHash = true;
|
||||
}
|
||||
}
|
||||
|
||||
$this->line .= $bin.$this->style($style, $key[1], $attr).(isset($attr['separator']) ? $attr['separator'] : ': ');
|
||||
} else {
|
||||
// This case should not happen
|
||||
$this->line .= '-'.$bin.'"'.$this->style('private', $key, array('class' => '')).'": ';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ($cursor->hardRefTo) {
|
||||
$this->line .= $this->style('ref', '&'.($cursor->hardRefCount ? $cursor->hardRefTo : ''), array('count' => $cursor->hardRefCount)).' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decorates a value with some style.
|
||||
*
|
||||
* @param string $style The type of style being applied
|
||||
* @param string $value The value being styled
|
||||
* @param array $attr Optional context information
|
||||
*
|
||||
* @return string The value with style decoration
|
||||
*/
|
||||
protected function style($style, $value, $attr = array())
|
||||
{
|
||||
if (null === $this->colors) {
|
||||
$this->colors = $this->supportsColors();
|
||||
}
|
||||
|
||||
if (isset($attr['ellipsis'], $attr['ellipsis-type'])) {
|
||||
$prefix = substr($value, 0, -$attr['ellipsis']);
|
||||
if ('cli' === PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && 0 === strpos($prefix, $_SERVER[$pwd])) {
|
||||
$prefix = '.'.substr($prefix, strlen($_SERVER[$pwd]));
|
||||
}
|
||||
if (!empty($attr['ellipsis-tail'])) {
|
||||
$prefix .= substr($value, -$attr['ellipsis'], $attr['ellipsis-tail']);
|
||||
$value = substr($value, -$attr['ellipsis'] + $attr['ellipsis-tail']);
|
||||
} else {
|
||||
$value = substr($value, -$attr['ellipsis']);
|
||||
}
|
||||
|
||||
return $this->style('default', $prefix).$this->style($style, $value);
|
||||
}
|
||||
|
||||
$style = $this->styles[$style];
|
||||
|
||||
$map = static::$controlCharsMap;
|
||||
$startCchr = $this->colors ? "\033[m\033[{$this->styles['default']}m" : '';
|
||||
$endCchr = $this->colors ? "\033[m\033[{$style}m" : '';
|
||||
$value = preg_replace_callback(static::$controlCharsRx, function ($c) use ($map, $startCchr, $endCchr) {
|
||||
$s = $startCchr;
|
||||
$c = $c[$i = 0];
|
||||
do {
|
||||
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', ord($c[$i]));
|
||||
} while (isset($c[++$i]));
|
||||
|
||||
return $s.$endCchr;
|
||||
}, $value, -1, $cchrCount);
|
||||
|
||||
if ($this->colors) {
|
||||
if ($cchrCount && "\033" === $value[0]) {
|
||||
$value = substr($value, strlen($startCchr));
|
||||
} else {
|
||||
$value = "\033[{$style}m".$value;
|
||||
}
|
||||
if ($cchrCount && $endCchr === substr($value, -strlen($endCchr))) {
|
||||
$value = substr($value, 0, -strlen($endCchr));
|
||||
} else {
|
||||
$value .= "\033[{$this->styles['default']}m";
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool Tells if the current output stream supports ANSI colors or not
|
||||
*/
|
||||
protected function supportsColors()
|
||||
{
|
||||
if ($this->outputStream !== static::$defaultOutput) {
|
||||
return @(is_resource($this->outputStream) && function_exists('posix_isatty') && posix_isatty($this->outputStream));
|
||||
}
|
||||
if (null !== static::$defaultColors) {
|
||||
return static::$defaultColors;
|
||||
}
|
||||
if (isset($_SERVER['argv'][1])) {
|
||||
$colors = $_SERVER['argv'];
|
||||
$i = count($colors);
|
||||
while (--$i > 0) {
|
||||
if (isset($colors[$i][5])) {
|
||||
switch ($colors[$i]) {
|
||||
case '--ansi':
|
||||
case '--color':
|
||||
case '--color=yes':
|
||||
case '--color=force':
|
||||
case '--color=always':
|
||||
return static::$defaultColors = true;
|
||||
|
||||
case '--no-ansi':
|
||||
case '--color=no':
|
||||
case '--color=none':
|
||||
case '--color=never':
|
||||
return static::$defaultColors = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
static::$defaultColors = @(
|
||||
'10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
|
||||
|| false !== getenv('ANSICON')
|
||||
|| 'ON' === getenv('ConEmuANSI')
|
||||
|| 'xterm' === getenv('TERM')
|
||||
);
|
||||
} elseif (function_exists('posix_isatty')) {
|
||||
$h = stream_get_meta_data($this->outputStream) + array('wrapper_type' => null);
|
||||
$h = 'Output' === $h['stream_type'] && 'PHP' === $h['wrapper_type'] ? fopen('php://stdout', 'wb') : $this->outputStream;
|
||||
static::$defaultColors = @posix_isatty($h);
|
||||
} else {
|
||||
static::$defaultColors = false;
|
||||
}
|
||||
|
||||
return static::$defaultColors;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function dumpLine($depth, $endOfValue = false)
|
||||
{
|
||||
if ($this->colors) {
|
||||
$this->line = sprintf("\033[%sm%s\033[m", $this->styles['default'], $this->line);
|
||||
}
|
||||
parent::dumpLine($depth);
|
||||
}
|
||||
|
||||
protected function endValue(Cursor $cursor)
|
||||
{
|
||||
if (Stub::ARRAY_INDEXED === $cursor->hashType || Stub::ARRAY_ASSOC === $cursor->hashType) {
|
||||
if (self::DUMP_TRAILING_COMMA & $this->flags && 0 < $cursor->depth) {
|
||||
$this->line .= ',';
|
||||
} elseif (self::DUMP_COMMA_SEPARATOR & $this->flags && 1 < $cursor->hashLength - $cursor->hashIndex) {
|
||||
$this->line .= ',';
|
||||
}
|
||||
}
|
||||
|
||||
$this->dumpLine($cursor->depth, true);
|
||||
}
|
||||
}
|
24
vendor/symfony/var-dumper/Dumper/DataDumperInterface.php
vendored
Normal file
24
vendor/symfony/var-dumper/Dumper/DataDumperInterface.php
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Dumper;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
|
||||
/**
|
||||
* DataDumperInterface for dumping Data objects.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
interface DataDumperInterface
|
||||
{
|
||||
public function dump(Data $data);
|
||||
}
|
897
vendor/symfony/var-dumper/Dumper/HtmlDumper.php
vendored
Normal file
897
vendor/symfony/var-dumper/Dumper/HtmlDumper.php
vendored
Normal file
|
@ -0,0 +1,897 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Dumper;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\Cursor;
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
|
||||
/**
|
||||
* HtmlDumper dumps variables as HTML.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class HtmlDumper extends CliDumper
|
||||
{
|
||||
public static $defaultOutput = 'php://output';
|
||||
|
||||
protected $dumpHeader;
|
||||
protected $dumpPrefix = '<pre class=sf-dump id=%s data-indent-pad="%s">';
|
||||
protected $dumpSuffix = '</pre><script>Sfdump(%s)</script>';
|
||||
protected $dumpId = 'sf-dump';
|
||||
protected $colors = true;
|
||||
protected $headerIsDumped = false;
|
||||
protected $lastDepth = -1;
|
||||
protected $styles = array(
|
||||
'default' => 'background-color:#18171B; color:#FF8400; line-height:1.2em; font:12px Menlo, Monaco, Consolas, monospace; word-wrap: break-word; white-space: pre-wrap; position:relative; z-index:99999; word-break: break-all',
|
||||
'num' => 'font-weight:bold; color:#1299DA',
|
||||
'const' => 'font-weight:bold',
|
||||
'str' => 'font-weight:bold; color:#56DB3A',
|
||||
'note' => 'color:#1299DA',
|
||||
'ref' => 'color:#A0A0A0',
|
||||
'public' => 'color:#FFFFFF',
|
||||
'protected' => 'color:#FFFFFF',
|
||||
'private' => 'color:#FFFFFF',
|
||||
'meta' => 'color:#B729D9',
|
||||
'key' => 'color:#56DB3A',
|
||||
'index' => 'color:#1299DA',
|
||||
'ellipsis' => 'color:#FF8400',
|
||||
);
|
||||
|
||||
private $displayOptions = array(
|
||||
'maxDepth' => 1,
|
||||
'maxStringLength' => 160,
|
||||
'fileLinkFormat' => null,
|
||||
);
|
||||
private $extraDisplayOptions = array();
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct($output = null, $charset = null, $flags = 0)
|
||||
{
|
||||
AbstractDumper::__construct($output, $charset, $flags);
|
||||
$this->dumpId = 'sf-dump-'.mt_rand();
|
||||
$this->displayOptions['fileLinkFormat'] = ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setStyles(array $styles)
|
||||
{
|
||||
$this->headerIsDumped = false;
|
||||
$this->styles = $styles + $this->styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures display options.
|
||||
*
|
||||
* @param array $displayOptions A map of display options to customize the behavior
|
||||
*/
|
||||
public function setDisplayOptions(array $displayOptions)
|
||||
{
|
||||
$this->headerIsDumped = false;
|
||||
$this->displayOptions = $displayOptions + $this->displayOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an HTML header that will be dumped once in the output stream.
|
||||
*
|
||||
* @param string $header An HTML string
|
||||
*/
|
||||
public function setDumpHeader($header)
|
||||
{
|
||||
$this->dumpHeader = $header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an HTML prefix and suffix that will encapse every single dump.
|
||||
*
|
||||
* @param string $prefix The prepended HTML string
|
||||
* @param string $suffix The appended HTML string
|
||||
*/
|
||||
public function setDumpBoundaries($prefix, $suffix)
|
||||
{
|
||||
$this->dumpPrefix = $prefix;
|
||||
$this->dumpSuffix = $suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function dump(Data $data, $output = null, array $extraDisplayOptions = array())
|
||||
{
|
||||
$this->extraDisplayOptions = $extraDisplayOptions;
|
||||
$result = parent::dump($data, $output);
|
||||
$this->dumpId = 'sf-dump-'.mt_rand();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dumps the HTML header.
|
||||
*/
|
||||
protected function getDumpHeader()
|
||||
{
|
||||
$this->headerIsDumped = null !== $this->outputStream ? $this->outputStream : $this->lineDumper;
|
||||
|
||||
if (null !== $this->dumpHeader) {
|
||||
return $this->dumpHeader;
|
||||
}
|
||||
|
||||
$line = str_replace('{$options}', json_encode($this->displayOptions, JSON_FORCE_OBJECT), <<<'EOHTML'
|
||||
<script>
|
||||
Sfdump = window.Sfdump || (function (doc) {
|
||||
|
||||
var refStyle = doc.createElement('style'),
|
||||
rxEsc = /([.*+?^${}()|\[\]\/\\])/g,
|
||||
idRx = /\bsf-dump-\d+-ref[012]\w+\b/,
|
||||
keyHint = 0 <= navigator.platform.toUpperCase().indexOf('MAC') ? 'Cmd' : 'Ctrl',
|
||||
addEventListener = function (e, n, cb) {
|
||||
e.addEventListener(n, cb, false);
|
||||
};
|
||||
|
||||
(doc.documentElement.firstElementChild || doc.documentElement.children[0]).appendChild(refStyle);
|
||||
|
||||
if (!doc.addEventListener) {
|
||||
addEventListener = function (element, eventName, callback) {
|
||||
element.attachEvent('on' + eventName, function (e) {
|
||||
e.preventDefault = function () {e.returnValue = false;};
|
||||
e.target = e.srcElement;
|
||||
callback(e);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function toggle(a, recursive) {
|
||||
var s = a.nextSibling || {}, oldClass = s.className, arrow, newClass;
|
||||
|
||||
if (/\bsf-dump-compact\b/.test(oldClass)) {
|
||||
arrow = '▼';
|
||||
newClass = 'sf-dump-expanded';
|
||||
} else if (/\bsf-dump-expanded\b/.test(oldClass)) {
|
||||
arrow = '▶';
|
||||
newClass = 'sf-dump-compact';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (doc.createEvent && s.dispatchEvent) {
|
||||
var event = doc.createEvent('Event');
|
||||
event.initEvent('sf-dump-expanded' === newClass ? 'sfbeforedumpexpand' : 'sfbeforedumpcollapse', true, false);
|
||||
|
||||
s.dispatchEvent(event);
|
||||
}
|
||||
|
||||
a.lastChild.innerHTML = arrow;
|
||||
s.className = s.className.replace(/\bsf-dump-(compact|expanded)\b/, newClass);
|
||||
|
||||
if (recursive) {
|
||||
try {
|
||||
a = s.querySelectorAll('.'+oldClass);
|
||||
for (s = 0; s < a.length; ++s) {
|
||||
if (-1 == a[s].className.indexOf(newClass)) {
|
||||
a[s].className = newClass;
|
||||
a[s].previousSibling.lastChild.innerHTML = arrow;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
function collapse(a, recursive) {
|
||||
var s = a.nextSibling || {}, oldClass = s.className;
|
||||
|
||||
if (/\bsf-dump-expanded\b/.test(oldClass)) {
|
||||
toggle(a, recursive);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function expand(a, recursive) {
|
||||
var s = a.nextSibling || {}, oldClass = s.className;
|
||||
|
||||
if (/\bsf-dump-compact\b/.test(oldClass)) {
|
||||
toggle(a, recursive);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
function collapseAll(root) {
|
||||
var a = root.querySelector('a.sf-dump-toggle');
|
||||
if (a) {
|
||||
collapse(a, true);
|
||||
expand(a);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function reveal(node) {
|
||||
var previous, parents = [];
|
||||
|
||||
while ((node = node.parentNode || {}) && (previous = node.previousSibling) && 'A' === previous.tagName) {
|
||||
parents.push(previous);
|
||||
}
|
||||
|
||||
if (0 !== parents.length) {
|
||||
parents.forEach(function (parent) {
|
||||
expand(parent);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function highlight(root, activeNode, nodes) {
|
||||
resetHighlightedNodes(root);
|
||||
|
||||
Array.from(nodes||[]).forEach(function (node) {
|
||||
if (!/\bsf-dump-highlight\b/.test(node.className)) {
|
||||
node.className = node.className + ' sf-dump-highlight';
|
||||
}
|
||||
});
|
||||
|
||||
if (!/\bsf-dump-highlight-active\b/.test(activeNode.className)) {
|
||||
activeNode.className = activeNode.className + ' sf-dump-highlight-active';
|
||||
}
|
||||
}
|
||||
|
||||
function resetHighlightedNodes(root) {
|
||||
Array.from(root.querySelectorAll('.sf-dump-str, .sf-dump-key, .sf-dump-public, .sf-dump-protected, .sf-dump-private')).forEach(function (strNode) {
|
||||
strNode.className = strNode.className.replace(/\bsf-dump-highlight\b/, '');
|
||||
strNode.className = strNode.className.replace(/\bsf-dump-highlight-active\b/, '');
|
||||
});
|
||||
}
|
||||
|
||||
return function (root, x) {
|
||||
root = doc.getElementById(root);
|
||||
|
||||
var indentRx = new RegExp('^('+(root.getAttribute('data-indent-pad') || ' ').replace(rxEsc, '\\$1')+')+', 'm'),
|
||||
options = {$options},
|
||||
elt = root.getElementsByTagName('A'),
|
||||
len = elt.length,
|
||||
i = 0, s, h,
|
||||
t = [];
|
||||
|
||||
while (i < len) t.push(elt[i++]);
|
||||
|
||||
for (i in x) {
|
||||
options[i] = x[i];
|
||||
}
|
||||
|
||||
function a(e, f) {
|
||||
addEventListener(root, e, function (e) {
|
||||
if ('A' == e.target.tagName) {
|
||||
f(e.target, e);
|
||||
} else if ('A' == e.target.parentNode.tagName) {
|
||||
f(e.target.parentNode, e);
|
||||
} else if (e.target.nextElementSibling && 'A' == e.target.nextElementSibling.tagName) {
|
||||
f(e.target.nextElementSibling, e, true);
|
||||
}
|
||||
});
|
||||
};
|
||||
function isCtrlKey(e) {
|
||||
return e.ctrlKey || e.metaKey;
|
||||
}
|
||||
function xpathString(str) {
|
||||
var parts = str.match(/[^'"]+|['"]/g).map(function (part) {
|
||||
if ("'" == part) {
|
||||
return '"\'"';
|
||||
}
|
||||
if ('"' == part) {
|
||||
return "'\"'";
|
||||
}
|
||||
|
||||
return "'" + part + "'";
|
||||
});
|
||||
|
||||
return "concat(" + parts.join(",") + ", '')";
|
||||
}
|
||||
addEventListener(root, 'mouseover', function (e) {
|
||||
if ('' != refStyle.innerHTML) {
|
||||
refStyle.innerHTML = '';
|
||||
}
|
||||
});
|
||||
a('mouseover', function (a, e, c) {
|
||||
if (c) {
|
||||
e.target.style.cursor = "pointer";
|
||||
} else if (a = idRx.exec(a.className)) {
|
||||
try {
|
||||
refStyle.innerHTML = 'pre.sf-dump .'+a[0]+'{background-color: #B729D9; color: #FFF !important; border-radius: 2px}';
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
});
|
||||
a('click', function (a, e, c) {
|
||||
if (/\bsf-dump-toggle\b/.test(a.className)) {
|
||||
e.preventDefault();
|
||||
if (!toggle(a, isCtrlKey(e))) {
|
||||
var r = doc.getElementById(a.getAttribute('href').substr(1)),
|
||||
s = r.previousSibling,
|
||||
f = r.parentNode,
|
||||
t = a.parentNode;
|
||||
t.replaceChild(r, a);
|
||||
f.replaceChild(a, s);
|
||||
t.insertBefore(s, r);
|
||||
f = f.firstChild.nodeValue.match(indentRx);
|
||||
t = t.firstChild.nodeValue.match(indentRx);
|
||||
if (f && t && f[0] !== t[0]) {
|
||||
r.innerHTML = r.innerHTML.replace(new RegExp('^'+f[0].replace(rxEsc, '\\$1'), 'mg'), t[0]);
|
||||
}
|
||||
if (/\bsf-dump-compact\b/.test(r.className)) {
|
||||
toggle(s, isCtrlKey(e));
|
||||
}
|
||||
}
|
||||
|
||||
if (c) {
|
||||
} else if (doc.getSelection) {
|
||||
try {
|
||||
doc.getSelection().removeAllRanges();
|
||||
} catch (e) {
|
||||
doc.getSelection().empty();
|
||||
}
|
||||
} else {
|
||||
doc.selection.empty();
|
||||
}
|
||||
} else if (/\bsf-dump-str-toggle\b/.test(a.className)) {
|
||||
e.preventDefault();
|
||||
e = a.parentNode.parentNode;
|
||||
e.className = e.className.replace(/\bsf-dump-str-(expand|collapse)\b/, a.parentNode.className);
|
||||
}
|
||||
});
|
||||
|
||||
elt = root.getElementsByTagName('SAMP');
|
||||
len = elt.length;
|
||||
i = 0;
|
||||
|
||||
while (i < len) t.push(elt[i++]);
|
||||
len = t.length;
|
||||
|
||||
for (i = 0; i < len; ++i) {
|
||||
elt = t[i];
|
||||
if ('SAMP' == elt.tagName) {
|
||||
a = elt.previousSibling || {};
|
||||
if ('A' != a.tagName) {
|
||||
a = doc.createElement('A');
|
||||
a.className = 'sf-dump-ref';
|
||||
elt.parentNode.insertBefore(a, elt);
|
||||
} else {
|
||||
a.innerHTML += ' ';
|
||||
}
|
||||
a.title = (a.title ? a.title+'\n[' : '[')+keyHint+'+click] Expand all children';
|
||||
a.innerHTML += '<span>▼</span>';
|
||||
a.className += ' sf-dump-toggle';
|
||||
|
||||
x = 1;
|
||||
if ('sf-dump' != elt.parentNode.className) {
|
||||
x += elt.parentNode.getAttribute('data-depth')/1;
|
||||
}
|
||||
elt.setAttribute('data-depth', x);
|
||||
var className = elt.className;
|
||||
elt.className = 'sf-dump-expanded';
|
||||
if (className ? 'sf-dump-expanded' !== className : (x > options.maxDepth)) {
|
||||
toggle(a);
|
||||
}
|
||||
} else if (/\bsf-dump-ref\b/.test(elt.className) && (a = elt.getAttribute('href'))) {
|
||||
a = a.substr(1);
|
||||
elt.className += ' '+a;
|
||||
|
||||
if (/[\[{]$/.test(elt.previousSibling.nodeValue)) {
|
||||
a = a != elt.nextSibling.id && doc.getElementById(a);
|
||||
try {
|
||||
s = a.nextSibling;
|
||||
elt.appendChild(a);
|
||||
s.parentNode.insertBefore(a, s);
|
||||
if (/^[@#]/.test(elt.innerHTML)) {
|
||||
elt.innerHTML += ' <span>▶</span>';
|
||||
} else {
|
||||
elt.innerHTML = '<span>▶</span>';
|
||||
elt.className = 'sf-dump-ref';
|
||||
}
|
||||
elt.className += ' sf-dump-toggle';
|
||||
} catch (e) {
|
||||
if ('&' == elt.innerHTML.charAt(0)) {
|
||||
elt.innerHTML = '…';
|
||||
elt.className = 'sf-dump-ref';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (doc.evaluate && Array.from && root.children.length > 1) {
|
||||
root.setAttribute('tabindex', 0);
|
||||
|
||||
SearchState = function () {
|
||||
this.nodes = [];
|
||||
this.idx = 0;
|
||||
};
|
||||
SearchState.prototype = {
|
||||
next: function () {
|
||||
if (this.isEmpty()) {
|
||||
return this.current();
|
||||
}
|
||||
this.idx = this.idx < (this.nodes.length - 1) ? this.idx + 1 : 0;
|
||||
|
||||
return this.current();
|
||||
},
|
||||
previous: function () {
|
||||
if (this.isEmpty()) {
|
||||
return this.current();
|
||||
}
|
||||
this.idx = this.idx > 0 ? this.idx - 1 : (this.nodes.length - 1);
|
||||
|
||||
return this.current();
|
||||
},
|
||||
isEmpty: function () {
|
||||
return 0 === this.count();
|
||||
},
|
||||
current: function () {
|
||||
if (this.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return this.nodes[this.idx];
|
||||
},
|
||||
reset: function () {
|
||||
this.nodes = [];
|
||||
this.idx = 0;
|
||||
},
|
||||
count: function () {
|
||||
return this.nodes.length;
|
||||
},
|
||||
};
|
||||
|
||||
function showCurrent(state)
|
||||
{
|
||||
var currentNode = state.current();
|
||||
if (currentNode) {
|
||||
reveal(currentNode);
|
||||
highlight(root, currentNode, state.nodes);
|
||||
}
|
||||
counter.textContent = (state.isEmpty() ? 0 : state.idx + 1) + ' of ' + state.count();
|
||||
}
|
||||
|
||||
var search = doc.createElement('div');
|
||||
search.className = 'sf-dump-search-wrapper sf-dump-search-hidden';
|
||||
search.innerHTML = '
|
||||
<input type="text" class="sf-dump-search-input">
|
||||
<span class="sf-dump-search-count">0 of 0<\/span>
|
||||
<button type="button" class="sf-dump-search-input-previous" tabindex="-1">
|
||||
<svg viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1683 1331l-166 165q-19 19-45 19t-45-19l-531-531-531 531q-19 19-45 19t-45-19l-166-165q-19-19-19-45.5t19-45.5l742-741q19-19 45-19t45 19l742 741q19 19 19 45.5t-19 45.5z"\/>
|
||||
<\/svg>
|
||||
<\/button>
|
||||
<button type="button" class="sf-dump-search-input-next" tabindex="-1">
|
||||
<svg viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1683 808l-742 741q-19 19-45 19t-45-19l-742-741q-19-19-19-45.5t19-45.5l166-165q19-19 45-19t45 19l531 531 531-531q19-19 45-19t45 19l166 165q19 19 19 45.5t-19 45.5z"\/>
|
||||
<\/svg>
|
||||
<\/button>
|
||||
';
|
||||
root.insertBefore(search, root.firstChild);
|
||||
|
||||
var state = new SearchState();
|
||||
var searchInput = search.querySelector('.sf-dump-search-input');
|
||||
var counter = search.querySelector('.sf-dump-search-count');
|
||||
var searchInputTimer = 0;
|
||||
var previousSearchQuery = '';
|
||||
|
||||
addEventListener(searchInput, 'keyup', function (e) {
|
||||
var searchQuery = e.target.value;
|
||||
/* Don't perform anything if the pressed key didn't change the query */
|
||||
if (searchQuery === previousSearchQuery) {
|
||||
return;
|
||||
}
|
||||
previousSearchQuery = searchQuery;
|
||||
clearTimeout(searchInputTimer);
|
||||
searchInputTimer = setTimeout(function () {
|
||||
state.reset();
|
||||
collapseAll(root);
|
||||
resetHighlightedNodes(root);
|
||||
if ('' === searchQuery) {
|
||||
counter.textContent = '0 of 0';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var xpathResult = doc.evaluate('//pre[@id="' + root.id + '"]//span[@class="sf-dump-str" or @class="sf-dump-key" or @class="sf-dump-public" or @class="sf-dump-protected" or @class="sf-dump-private"][contains(translate(child::text(), ' + xpathString(searchQuery.toUpperCase()) + ', ' + xpathString(searchQuery.toLowerCase()) + '), ' + xpathString(searchQuery.toLowerCase()) + ')]', document, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
|
||||
|
||||
while (node = xpathResult.iterateNext()) state.nodes.push(node);
|
||||
|
||||
showCurrent(state);
|
||||
}, 400);
|
||||
});
|
||||
|
||||
Array.from(search.querySelectorAll('.sf-dump-search-input-next, .sf-dump-search-input-previous')).forEach(function (btn) {
|
||||
addEventListener(btn, 'click', function (e) {
|
||||
e.preventDefault();
|
||||
-1 !== e.target.className.indexOf('next') ? state.next() : state.previous();
|
||||
searchInput.focus();
|
||||
collapseAll(root);
|
||||
showCurrent(state);
|
||||
})
|
||||
});
|
||||
|
||||
addEventListener(root, 'keydown', function (e) {
|
||||
var isSearchActive = !/\bsf-dump-search-hidden\b/.test(search.className);
|
||||
if ((114 === e.keyCode && !isSearchActive) || (isCtrlKey(e) && 70 === e.keyCode)) {
|
||||
/* F3 or CMD/CTRL + F */
|
||||
e.preventDefault();
|
||||
search.className = search.className.replace(/\bsf-dump-search-hidden\b/, '');
|
||||
searchInput.focus();
|
||||
} else if (isSearchActive) {
|
||||
if (27 === e.keyCode) {
|
||||
/* ESC key */
|
||||
search.className += ' sf-dump-search-hidden';
|
||||
e.preventDefault();
|
||||
resetHighlightedNodes(root);
|
||||
searchInput.value = '';
|
||||
} else if (
|
||||
(isCtrlKey(e) && 71 === e.keyCode) /* CMD/CTRL + G */
|
||||
|| 13 === e.keyCode /* Enter */
|
||||
|| 114 === e.keyCode /* F3 */
|
||||
) {
|
||||
e.preventDefault();
|
||||
e.shiftKey ? state.previous() : state.next();
|
||||
collapseAll(root);
|
||||
showCurrent(state);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (0 >= options.maxStringLength) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
elt = root.querySelectorAll('.sf-dump-str');
|
||||
len = elt.length;
|
||||
i = 0;
|
||||
t = [];
|
||||
|
||||
while (i < len) t.push(elt[i++]);
|
||||
len = t.length;
|
||||
|
||||
for (i = 0; i < len; ++i) {
|
||||
elt = t[i];
|
||||
s = elt.innerText || elt.textContent;
|
||||
x = s.length - options.maxStringLength;
|
||||
if (0 < x) {
|
||||
h = elt.innerHTML;
|
||||
elt[elt.innerText ? 'innerText' : 'textContent'] = s.substring(0, options.maxStringLength);
|
||||
elt.className += ' sf-dump-str-collapse';
|
||||
elt.innerHTML = '<span class=sf-dump-str-collapse>'+h+'<a class="sf-dump-ref sf-dump-str-toggle" title="Collapse"> ◀</a></span>'+
|
||||
'<span class=sf-dump-str-expand>'+elt.innerHTML+'<a class="sf-dump-ref sf-dump-str-toggle" title="'+x+' remaining characters"> ▶</a></span>';
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
};
|
||||
|
||||
})(document);
|
||||
</script><style>
|
||||
pre.sf-dump {
|
||||
display: block;
|
||||
white-space: pre;
|
||||
padding: 5px;
|
||||
}
|
||||
pre.sf-dump:after {
|
||||
content: "";
|
||||
visibility: hidden;
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
}
|
||||
pre.sf-dump span {
|
||||
display: inline;
|
||||
}
|
||||
pre.sf-dump .sf-dump-compact {
|
||||
display: none;
|
||||
}
|
||||
pre.sf-dump abbr {
|
||||
text-decoration: none;
|
||||
border: none;
|
||||
cursor: help;
|
||||
}
|
||||
pre.sf-dump a {
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
border: 0;
|
||||
outline: none;
|
||||
color: inherit;
|
||||
}
|
||||
pre.sf-dump .sf-dump-ellipsis {
|
||||
display: inline-block;
|
||||
overflow: visible;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 5em;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
vertical-align: top;
|
||||
}
|
||||
pre.sf-dump .sf-dump-ellipsis+.sf-dump-ellipsis {
|
||||
max-width: none;
|
||||
}
|
||||
pre.sf-dump code {
|
||||
display:inline;
|
||||
padding:0;
|
||||
background:none;
|
||||
}
|
||||
.sf-dump-str-collapse .sf-dump-str-collapse {
|
||||
display: none;
|
||||
}
|
||||
.sf-dump-str-expand .sf-dump-str-expand {
|
||||
display: none;
|
||||
}
|
||||
.sf-dump-public.sf-dump-highlight,
|
||||
.sf-dump-protected.sf-dump-highlight,
|
||||
.sf-dump-private.sf-dump-highlight,
|
||||
.sf-dump-str.sf-dump-highlight,
|
||||
.sf-dump-key.sf-dump-highlight {
|
||||
background: rgba(111, 172, 204, 0.3);
|
||||
border: 1px solid #7DA0B1;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.sf-dump-public.sf-dump-highlight-active,
|
||||
.sf-dump-protected.sf-dump-highlight-active,
|
||||
.sf-dump-private.sf-dump-highlight-active,
|
||||
.sf-dump-str.sf-dump-highlight-active,
|
||||
.sf-dump-key.sf-dump-highlight-active {
|
||||
background: rgba(253, 175, 0, 0.4);
|
||||
border: 1px solid #ffa500;
|
||||
border-radius: 3px;
|
||||
}
|
||||
pre.sf-dump .sf-dump-search-hidden {
|
||||
display: none;
|
||||
}
|
||||
pre.sf-dump .sf-dump-search-wrapper {
|
||||
float: right;
|
||||
font-size: 0;
|
||||
white-space: nowrap;
|
||||
max-width: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
pre.sf-dump .sf-dump-search-wrapper > * {
|
||||
vertical-align: top;
|
||||
box-sizing: border-box;
|
||||
height: 21px;
|
||||
font-weight: normal;
|
||||
border-radius: 0;
|
||||
background: #FFF;
|
||||
color: #757575;
|
||||
border: 1px solid #BBB;
|
||||
}
|
||||
pre.sf-dump .sf-dump-search-wrapper > input.sf-dump-search-input {
|
||||
padding: 3px;
|
||||
height: 21px;
|
||||
font-size: 12px;
|
||||
border-right: none;
|
||||
width: 140px;
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
color: #000;
|
||||
}
|
||||
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next,
|
||||
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-previous {
|
||||
background: #F2F2F2;
|
||||
outline: none;
|
||||
border-left: none;
|
||||
font-size: 0;
|
||||
line-height: 0;
|
||||
}
|
||||
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next {
|
||||
border-top-right-radius: 3px;
|
||||
border-bottom-right-radius: 3px;
|
||||
}
|
||||
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-next > svg,
|
||||
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-input-previous > svg {
|
||||
pointer-events: none;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
pre.sf-dump .sf-dump-search-wrapper > .sf-dump-search-count {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
margin: 0;
|
||||
border-left: none;
|
||||
line-height: 21px;
|
||||
font-size: 12px;
|
||||
}
|
||||
EOHTML
|
||||
);
|
||||
|
||||
foreach ($this->styles as $class => $style) {
|
||||
$line .= 'pre.sf-dump'.('default' === $class ? ', pre.sf-dump' : '').' .sf-dump-'.$class.'{'.$style.'}';
|
||||
}
|
||||
|
||||
return $this->dumpHeader = preg_replace('/\s+/', ' ', $line).'</style>'.$this->dumpHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
|
||||
{
|
||||
parent::enterHash($cursor, $type, $class, false);
|
||||
|
||||
if ($cursor->skipChildren) {
|
||||
$cursor->skipChildren = false;
|
||||
$eol = ' class=sf-dump-compact>';
|
||||
} elseif ($this->expandNextHash) {
|
||||
$this->expandNextHash = false;
|
||||
$eol = ' class=sf-dump-expanded>';
|
||||
} else {
|
||||
$eol = '>';
|
||||
}
|
||||
|
||||
if ($hasChild) {
|
||||
$this->line .= '<samp';
|
||||
if ($cursor->refIndex) {
|
||||
$r = Cursor::HASH_OBJECT !== $type ? 1 - (Cursor::HASH_RESOURCE !== $type) : 2;
|
||||
$r .= $r && 0 < $cursor->softRefHandle ? $cursor->softRefHandle : $cursor->refIndex;
|
||||
|
||||
$this->line .= sprintf(' id=%s-ref%s', $this->dumpId, $r);
|
||||
}
|
||||
$this->line .= $eol;
|
||||
$this->dumpLine($cursor->depth);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function leaveHash(Cursor $cursor, $type, $class, $hasChild, $cut)
|
||||
{
|
||||
$this->dumpEllipsis($cursor, $hasChild, $cut);
|
||||
if ($hasChild) {
|
||||
$this->line .= '</samp>';
|
||||
}
|
||||
parent::leaveHash($cursor, $type, $class, $hasChild, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function style($style, $value, $attr = array())
|
||||
{
|
||||
if ('' === $value) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$v = esc($value);
|
||||
|
||||
if ('ref' === $style) {
|
||||
if (empty($attr['count'])) {
|
||||
return sprintf('<a class=sf-dump-ref>%s</a>', $v);
|
||||
}
|
||||
$r = ('#' !== $v[0] ? 1 - ('@' !== $v[0]) : 2).substr($value, 1);
|
||||
|
||||
return sprintf('<a class=sf-dump-ref href=#%s-ref%s title="%d occurrences">%s</a>', $this->dumpId, $r, 1 + $attr['count'], $v);
|
||||
}
|
||||
|
||||
if ('const' === $style && isset($attr['value'])) {
|
||||
$style .= sprintf(' title="%s"', esc(is_scalar($attr['value']) ? $attr['value'] : json_encode($attr['value'])));
|
||||
} elseif ('public' === $style) {
|
||||
$style .= sprintf(' title="%s"', empty($attr['dynamic']) ? 'Public property' : 'Runtime added dynamic property');
|
||||
} elseif ('str' === $style && 1 < $attr['length']) {
|
||||
$style .= sprintf(' title="%d%s characters"', $attr['length'], $attr['binary'] ? ' binary or non-UTF-8' : '');
|
||||
} elseif ('note' === $style && false !== $c = strrpos($v, '\\')) {
|
||||
return sprintf('<abbr title="%s" class=sf-dump-%s>%s</abbr>', $v, $style, substr($v, $c + 1));
|
||||
} elseif ('protected' === $style) {
|
||||
$style .= ' title="Protected property"';
|
||||
} elseif ('meta' === $style && isset($attr['title'])) {
|
||||
$style .= sprintf(' title="%s"', esc($this->utf8Encode($attr['title'])));
|
||||
} elseif ('private' === $style) {
|
||||
$style .= sprintf(' title="Private property defined in class: `%s`"', esc($this->utf8Encode($attr['class'])));
|
||||
}
|
||||
$map = static::$controlCharsMap;
|
||||
|
||||
if (isset($attr['ellipsis'])) {
|
||||
$class = 'sf-dump-ellipsis';
|
||||
if (isset($attr['ellipsis-type'])) {
|
||||
$class = sprintf('"%s sf-dump-ellipsis-%s"', $class, $attr['ellipsis-type']);
|
||||
}
|
||||
$label = esc(substr($value, -$attr['ellipsis']));
|
||||
$style = str_replace(' title="', " title=\"$v\n", $style);
|
||||
$v = sprintf('<span class=%s>%s</span>', $class, substr($v, 0, -strlen($label)));
|
||||
|
||||
if (!empty($attr['ellipsis-tail'])) {
|
||||
$tail = strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail'])));
|
||||
$v .= sprintf('<span class=sf-dump-ellipsis>%s</span>%s', substr($label, 0, $tail), substr($label, $tail));
|
||||
} else {
|
||||
$v .= $label;
|
||||
}
|
||||
}
|
||||
|
||||
$v = "<span class=sf-dump-{$style}>".preg_replace_callback(static::$controlCharsRx, function ($c) use ($map) {
|
||||
$s = '<span class=sf-dump-default>';
|
||||
$c = $c[$i = 0];
|
||||
do {
|
||||
$s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', ord($c[$i]));
|
||||
} while (isset($c[++$i]));
|
||||
|
||||
return $s.'</span>';
|
||||
}, $v).'</span>';
|
||||
|
||||
if (isset($attr['file']) && $href = $this->getSourceLink($attr['file'], isset($attr['line']) ? $attr['line'] : 0)) {
|
||||
$attr['href'] = $href;
|
||||
}
|
||||
if (isset($attr['href'])) {
|
||||
$target = isset($attr['file']) ? '' : ' target="_blank"';
|
||||
$v = sprintf('<a href="%s"%s rel="noopener noreferrer">%s</a>', esc($this->utf8Encode($attr['href'])), $target, $v);
|
||||
}
|
||||
if (isset($attr['lang'])) {
|
||||
$v = sprintf('<code class="%s">%s</code>', esc($attr['lang']), $v);
|
||||
}
|
||||
|
||||
return $v;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function dumpLine($depth, $endOfValue = false)
|
||||
{
|
||||
if (-1 === $this->lastDepth) {
|
||||
$this->line = sprintf($this->dumpPrefix, $this->dumpId, $this->indentPad).$this->line;
|
||||
}
|
||||
if ($this->headerIsDumped !== (null !== $this->outputStream ? $this->outputStream : $this->lineDumper)) {
|
||||
$this->line = $this->getDumpHeader().$this->line;
|
||||
}
|
||||
|
||||
if (-1 === $depth) {
|
||||
$args = array('"'.$this->dumpId.'"');
|
||||
if ($this->extraDisplayOptions) {
|
||||
$args[] = json_encode($this->extraDisplayOptions, JSON_FORCE_OBJECT);
|
||||
}
|
||||
// Replace is for BC
|
||||
$this->line .= sprintf(str_replace('"%s"', '%s', $this->dumpSuffix), implode(', ', $args));
|
||||
}
|
||||
$this->lastDepth = $depth;
|
||||
|
||||
$this->line = mb_convert_encoding($this->line, 'HTML-ENTITIES', 'UTF-8');
|
||||
|
||||
if (-1 === $depth) {
|
||||
AbstractDumper::dumpLine(0);
|
||||
}
|
||||
AbstractDumper::dumpLine($depth);
|
||||
}
|
||||
|
||||
private function getSourceLink($file, $line)
|
||||
{
|
||||
$options = $this->extraDisplayOptions + $this->displayOptions;
|
||||
|
||||
if ($fmt = $options['fileLinkFormat']) {
|
||||
return is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function esc($str)
|
||||
{
|
||||
return htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
|
||||
}
|
26
vendor/symfony/var-dumper/Exception/ThrowingCasterException.php
vendored
Normal file
26
vendor/symfony/var-dumper/Exception/ThrowingCasterException.php
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Exception;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ThrowingCasterException extends \Exception
|
||||
{
|
||||
/**
|
||||
* @param \Exception $prev The exception thrown from the caster
|
||||
*/
|
||||
public function __construct(\Exception $prev)
|
||||
{
|
||||
parent::__construct('Unexpected '.get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev);
|
||||
}
|
||||
}
|
19
vendor/symfony/var-dumper/LICENSE
vendored
Normal file
19
vendor/symfony/var-dumper/LICENSE
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2014-2018 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
15
vendor/symfony/var-dumper/README.md
vendored
Normal file
15
vendor/symfony/var-dumper/README.md
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
VarDumper Component
|
||||
===================
|
||||
|
||||
The VarDumper component provides mechanisms for walking through any arbitrary
|
||||
PHP variable. Built on top, it provides a better `dump()` function that you
|
||||
can use instead of `var_dump`.
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
* [Documentation](https://symfony.com/doc/current/components/var_dumper/introduction.html)
|
||||
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
|
||||
* [Report issues](https://github.com/symfony/symfony/issues) and
|
||||
[send Pull Requests](https://github.com/symfony/symfony/pulls)
|
||||
in the [main Symfony repository](https://github.com/symfony/symfony)
|
30
vendor/symfony/var-dumper/Resources/functions/dump.php
vendored
Normal file
30
vendor/symfony/var-dumper/Resources/functions/dump.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Component\VarDumper\VarDumper;
|
||||
|
||||
if (!function_exists('dump')) {
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
function dump($var)
|
||||
{
|
||||
foreach (func_get_args() as $var) {
|
||||
VarDumper::dump($var);
|
||||
}
|
||||
|
||||
if (1 < func_num_args()) {
|
||||
return func_get_args();
|
||||
}
|
||||
|
||||
return $var;
|
||||
}
|
||||
}
|
60
vendor/symfony/var-dumper/Test/VarDumperTestTrait.php
vendored
Normal file
60
vendor/symfony/var-dumper/Test/VarDumperTestTrait.php
vendored
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Test;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
trait VarDumperTestTrait
|
||||
{
|
||||
public function assertDumpEquals($dump, $data, $filter = 0, $message = '')
|
||||
{
|
||||
if (is_string($filter)) {
|
||||
@trigger_error(sprintf('The $message argument of the "%s()" method at 3rd position is deprecated since Symfony 3.4 and will be moved at 4th position in 4.0.', __METHOD__), E_USER_DEPRECATED);
|
||||
$message = $filter;
|
||||
$filter = 0;
|
||||
}
|
||||
|
||||
$this->assertSame(rtrim($dump), $this->getDump($data, null, $filter), $message);
|
||||
}
|
||||
|
||||
public function assertDumpMatchesFormat($dump, $data, $filter = 0, $message = '')
|
||||
{
|
||||
if (is_string($filter)) {
|
||||
@trigger_error(sprintf('The $message argument of the "%s()" method at 3rd position is deprecated since Symfony 3.4 and will be moved at 4th position in 4.0.', __METHOD__), E_USER_DEPRECATED);
|
||||
$message = $filter;
|
||||
$filter = 0;
|
||||
}
|
||||
|
||||
$this->assertStringMatchesFormat(rtrim($dump), $this->getDump($data, null, $filter), $message);
|
||||
}
|
||||
|
||||
protected function getDump($data, $key = null, $filter = 0)
|
||||
{
|
||||
$flags = getenv('DUMP_LIGHT_ARRAY') ? CliDumper::DUMP_LIGHT_ARRAY : 0;
|
||||
$flags |= getenv('DUMP_STRING_LENGTH') ? CliDumper::DUMP_STRING_LENGTH : 0;
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$cloner->setMaxItems(-1);
|
||||
$dumper = new CliDumper(null, null, $flags);
|
||||
$dumper->setColors(false);
|
||||
$data = $cloner->cloneVar($data, $filter)->withRefHandles(false);
|
||||
if (null !== $key && null === $data = $data->seek($key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return rtrim($dumper->dump($data, true));
|
||||
}
|
||||
}
|
181
vendor/symfony/var-dumper/Tests/Caster/CasterTest.php
vendored
Normal file
181
vendor/symfony/var-dumper/Tests/Caster/CasterTest.php
vendored
Normal file
|
@ -0,0 +1,181 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Caster;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class CasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
private $referenceArray = array(
|
||||
'null' => null,
|
||||
'empty' => false,
|
||||
'public' => 'pub',
|
||||
"\0~\0virtual" => 'virt',
|
||||
"\0+\0dynamic" => 'dyn',
|
||||
"\0*\0protected" => 'prot',
|
||||
"\0Foo\0private" => 'priv',
|
||||
);
|
||||
|
||||
/**
|
||||
* @dataProvider provideFilter
|
||||
*/
|
||||
public function testFilter($filter, $expectedDiff, $listedProperties = null)
|
||||
{
|
||||
if (null === $listedProperties) {
|
||||
$filteredArray = Caster::filter($this->referenceArray, $filter);
|
||||
} else {
|
||||
$filteredArray = Caster::filter($this->referenceArray, $filter, $listedProperties);
|
||||
}
|
||||
|
||||
$this->assertSame($expectedDiff, array_diff_assoc($this->referenceArray, $filteredArray));
|
||||
}
|
||||
|
||||
public function provideFilter()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
0,
|
||||
array(),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_PUBLIC,
|
||||
array(
|
||||
'null' => null,
|
||||
'empty' => false,
|
||||
'public' => 'pub',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_NULL,
|
||||
array(
|
||||
'null' => null,
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_EMPTY,
|
||||
array(
|
||||
'null' => null,
|
||||
'empty' => false,
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_VIRTUAL,
|
||||
array(
|
||||
"\0~\0virtual" => 'virt',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_DYNAMIC,
|
||||
array(
|
||||
"\0+\0dynamic" => 'dyn',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_PROTECTED,
|
||||
array(
|
||||
"\0*\0protected" => 'prot',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_PRIVATE,
|
||||
array(
|
||||
"\0Foo\0private" => 'priv',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_VERBOSE,
|
||||
array(
|
||||
'public' => 'pub',
|
||||
"\0*\0protected" => 'prot',
|
||||
),
|
||||
array('public', "\0*\0protected"),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_NOT_IMPORTANT,
|
||||
array(
|
||||
'null' => null,
|
||||
'empty' => false,
|
||||
"\0~\0virtual" => 'virt',
|
||||
"\0+\0dynamic" => 'dyn',
|
||||
"\0Foo\0private" => 'priv',
|
||||
),
|
||||
array('public', "\0*\0protected"),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_VIRTUAL | Caster::EXCLUDE_DYNAMIC,
|
||||
array(
|
||||
"\0~\0virtual" => 'virt',
|
||||
"\0+\0dynamic" => 'dyn',
|
||||
),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_VERBOSE,
|
||||
$this->referenceArray,
|
||||
array('public', "\0*\0protected"),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_NOT_IMPORTANT | Caster::EXCLUDE_EMPTY,
|
||||
array(
|
||||
'null' => null,
|
||||
'empty' => false,
|
||||
"\0~\0virtual" => 'virt',
|
||||
"\0+\0dynamic" => 'dyn',
|
||||
"\0*\0protected" => 'prot',
|
||||
"\0Foo\0private" => 'priv',
|
||||
),
|
||||
array('public', 'empty'),
|
||||
),
|
||||
array(
|
||||
Caster::EXCLUDE_VERBOSE | Caster::EXCLUDE_EMPTY | Caster::EXCLUDE_STRICT,
|
||||
array(
|
||||
'empty' => false,
|
||||
),
|
||||
array('public', 'empty'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 7.0
|
||||
*/
|
||||
public function testAnonymousClass()
|
||||
{
|
||||
$c = eval('return new class extends stdClass { private $foo = "foo"; };');
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
stdClass@anonymous {
|
||||
-foo: "foo"
|
||||
}
|
||||
EOTXT
|
||||
, $c
|
||||
);
|
||||
|
||||
$c = eval('return new class { private $foo = "foo"; };');
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
@anonymous {
|
||||
-foo: "foo"
|
||||
}
|
||||
EOTXT
|
||||
, $c
|
||||
);
|
||||
}
|
||||
}
|
426
vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php
vendored
Normal file
426
vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php
vendored
Normal file
|
@ -0,0 +1,426 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Caster;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Caster\DateCaster;
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @author Dany Maillard <danymaillard93b@gmail.com>
|
||||
*/
|
||||
class DateCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @dataProvider provideDateTimes
|
||||
*/
|
||||
public function testDumpDateTime($time, $timezone, $xDate, $xTimestamp)
|
||||
{
|
||||
if ((defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) && preg_match('/[-+]\d{2}:\d{2}/', $timezone)) {
|
||||
$this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.');
|
||||
}
|
||||
|
||||
$date = new \DateTime($time, new \DateTimeZone($timezone));
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
DateTime @$xTimestamp {
|
||||
date: $xDate
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpEquals($xDump, $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideDateTimes
|
||||
*/
|
||||
public function testCastDateTime($time, $timezone, $xDate, $xTimestamp, $xInfos)
|
||||
{
|
||||
if ((defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) && preg_match('/[-+]\d{2}:\d{2}/', $timezone)) {
|
||||
$this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.');
|
||||
}
|
||||
|
||||
$stub = new Stub();
|
||||
$date = new \DateTime($time, new \DateTimeZone($timezone));
|
||||
$cast = DateCaster::castDateTime($date, array('foo' => 'bar'), $stub, false, 0);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
array:1 [
|
||||
"\\x00~\\x00date" => $xDate
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpEquals($xDump, $cast);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
Symfony\Component\VarDumper\Caster\ConstStub {
|
||||
+type: 1
|
||||
+class: "$xDate"
|
||||
+value: "%A$xInfos%A"
|
||||
+cut: 0
|
||||
+handle: 0
|
||||
+refCount: 0
|
||||
+position: 0
|
||||
+attr: []
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $cast["\0~\0date"]);
|
||||
}
|
||||
|
||||
public function provideDateTimes()
|
||||
{
|
||||
return array(
|
||||
array('2017-04-30 00:00:00.000000', 'Europe/Zurich', '2017-04-30 00:00:00.0 Europe/Zurich (+02:00)', 1493503200, 'Sunday, April 30, 2017%Afrom now%ADST On'),
|
||||
array('2017-12-31 00:00:00.000000', 'Europe/Zurich', '2017-12-31 00:00:00.0 Europe/Zurich (+01:00)', 1514674800, 'Sunday, December 31, 2017%Afrom now%ADST Off'),
|
||||
array('2017-04-30 00:00:00.000000', '+02:00', '2017-04-30 00:00:00.0 +02:00', 1493503200, 'Sunday, April 30, 2017%Afrom now'),
|
||||
|
||||
array('2017-04-30 00:00:00.100000', '+00:00', '2017-04-30 00:00:00.100 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
|
||||
array('2017-04-30 00:00:00.120000', '+00:00', '2017-04-30 00:00:00.120 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
|
||||
array('2017-04-30 00:00:00.123000', '+00:00', '2017-04-30 00:00:00.123 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
|
||||
array('2017-04-30 00:00:00.123400', '+00:00', '2017-04-30 00:00:00.123400 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
|
||||
array('2017-04-30 00:00:00.123450', '+00:00', '2017-04-30 00:00:00.123450 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
|
||||
array('2017-04-30 00:00:00.123456', '+00:00', '2017-04-30 00:00:00.123456 +00:00', 1493510400, 'Sunday, April 30, 2017%Afrom now'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideIntervals
|
||||
*/
|
||||
public function testDumpInterval($intervalSpec, $ms, $invert, $expected)
|
||||
{
|
||||
if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
|
||||
$this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.');
|
||||
}
|
||||
|
||||
$interval = $this->createInterval($intervalSpec, $ms, $invert);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
DateInterval {
|
||||
interval: $expected
|
||||
%A}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $interval);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideIntervals
|
||||
*/
|
||||
public function testDumpIntervalExcludingVerbosity($intervalSpec, $ms, $invert, $expected)
|
||||
{
|
||||
if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
|
||||
$this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.');
|
||||
}
|
||||
|
||||
$interval = $this->createInterval($intervalSpec, $ms, $invert);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
DateInterval {
|
||||
interval: $expected
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpEquals($xDump, $interval, Caster::EXCLUDE_VERBOSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideIntervals
|
||||
*/
|
||||
public function testCastInterval($intervalSpec, $ms, $invert, $xInterval, $xSeconds)
|
||||
{
|
||||
if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
|
||||
$this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.');
|
||||
}
|
||||
|
||||
$interval = $this->createInterval($intervalSpec, $ms, $invert);
|
||||
$stub = new Stub();
|
||||
|
||||
$cast = DateCaster::castInterval($interval, array('foo' => 'bar'), $stub, false, Caster::EXCLUDE_VERBOSE);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
array:1 [
|
||||
"\\x00~\\x00interval" => $xInterval
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpEquals($xDump, $cast);
|
||||
|
||||
if (null === $xSeconds) {
|
||||
return;
|
||||
}
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
Symfony\Component\VarDumper\Caster\ConstStub {
|
||||
+type: 1
|
||||
+class: "$xInterval"
|
||||
+value: "$xSeconds"
|
||||
+cut: 0
|
||||
+handle: 0
|
||||
+refCount: 0
|
||||
+position: 0
|
||||
+attr: []
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $cast["\0~\0interval"]);
|
||||
}
|
||||
|
||||
public function provideIntervals()
|
||||
{
|
||||
$i = new \DateInterval('PT0S');
|
||||
$ms = ($withMs = \PHP_VERSION_ID >= 70100 && isset($i->f)) ? '.0' : '';
|
||||
|
||||
return array(
|
||||
array('PT0S', 0, 0, '0s', '0s'),
|
||||
array('PT0S', 0.1, 0, $withMs ? '+ 00:00:00.100' : '0s', '%is'),
|
||||
array('PT1S', 0, 0, '+ 00:00:01'.$ms, '%is'),
|
||||
array('PT2M', 0, 0, '+ 00:02:00'.$ms, '%is'),
|
||||
array('PT3H', 0, 0, '+ 03:00:00'.$ms, '%ss'),
|
||||
array('P4D', 0, 0, '+ 4d', '%ss'),
|
||||
array('P5M', 0, 0, '+ 5m', null),
|
||||
array('P6Y', 0, 0, '+ 6y', null),
|
||||
array('P1Y2M3DT4H5M6S', 0, 0, '+ 1y 2m 3d 04:05:06'.$ms, null),
|
||||
array('PT1M60S', 0, 0, '+ 00:02:00'.$ms, null),
|
||||
array('PT1H60M', 0, 0, '+ 02:00:00'.$ms, null),
|
||||
array('P1DT24H', 0, 0, '+ 2d', null),
|
||||
array('P1M32D', 0, 0, '+ 1m 32d', null),
|
||||
|
||||
array('PT0S', 0, 1, '0s', '0s'),
|
||||
array('PT0S', 0.1, 1, $withMs ? '- 00:00:00.100' : '0s', '%is'),
|
||||
array('PT1S', 0, 1, '- 00:00:01'.$ms, '%is'),
|
||||
array('PT2M', 0, 1, '- 00:02:00'.$ms, '%is'),
|
||||
array('PT3H', 0, 1, '- 03:00:00'.$ms, '%ss'),
|
||||
array('P4D', 0, 1, '- 4d', '%ss'),
|
||||
array('P5M', 0, 1, '- 5m', null),
|
||||
array('P6Y', 0, 1, '- 6y', null),
|
||||
array('P1Y2M3DT4H5M6S', 0, 1, '- 1y 2m 3d 04:05:06'.$ms, null),
|
||||
array('PT1M60S', 0, 1, '- 00:02:00'.$ms, null),
|
||||
array('PT1H60M', 0, 1, '- 02:00:00'.$ms, null),
|
||||
array('P1DT24H', 0, 1, '- 2d', null),
|
||||
array('P1M32D', 0, 1, '- 1m 32d', null),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideTimeZones
|
||||
*/
|
||||
public function testDumpTimeZone($timezone, $expected)
|
||||
{
|
||||
if ((defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) && !preg_match('/\w+\/\w+/', $timezone)) {
|
||||
$this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.');
|
||||
}
|
||||
|
||||
$timezone = new \DateTimeZone($timezone);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
DateTimeZone {
|
||||
timezone: $expected
|
||||
%A}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $timezone);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideTimeZones
|
||||
*/
|
||||
public function testDumpTimeZoneExcludingVerbosity($timezone, $expected)
|
||||
{
|
||||
if ((defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) && !preg_match('/\w+\/\w+/', $timezone)) {
|
||||
$this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.');
|
||||
}
|
||||
|
||||
$timezone = new \DateTimeZone($timezone);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
DateTimeZone {
|
||||
timezone: $expected
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $timezone, Caster::EXCLUDE_VERBOSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideTimeZones
|
||||
*/
|
||||
public function testCastTimeZone($timezone, $xTimezone, $xRegion)
|
||||
{
|
||||
if ((defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) && !preg_match('/\w+\/\w+/', $timezone)) {
|
||||
$this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.');
|
||||
}
|
||||
|
||||
$timezone = new \DateTimeZone($timezone);
|
||||
$stub = new Stub();
|
||||
|
||||
$cast = DateCaster::castTimeZone($timezone, array('foo' => 'bar'), $stub, false, Caster::EXCLUDE_VERBOSE);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
array:1 [
|
||||
"\\x00~\\x00timezone" => $xTimezone
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $cast);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
Symfony\Component\VarDumper\Caster\ConstStub {
|
||||
+type: 1
|
||||
+class: "$xTimezone"
|
||||
+value: "$xRegion"
|
||||
+cut: 0
|
||||
+handle: 0
|
||||
+refCount: 0
|
||||
+position: 0
|
||||
+attr: []
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $cast["\0~\0timezone"]);
|
||||
}
|
||||
|
||||
public function provideTimeZones()
|
||||
{
|
||||
$xRegion = extension_loaded('intl') ? '%s' : '';
|
||||
|
||||
return array(
|
||||
// type 1 (UTC offset)
|
||||
array('-12:00', '-12:00', ''),
|
||||
array('+00:00', '+00:00', ''),
|
||||
array('+14:00', '+14:00', ''),
|
||||
|
||||
// type 2 (timezone abbreviation)
|
||||
array('GMT', '+00:00', ''),
|
||||
array('a', '+01:00', ''),
|
||||
array('b', '+02:00', ''),
|
||||
array('z', '+00:00', ''),
|
||||
|
||||
// type 3 (timezone identifier)
|
||||
array('Africa/Tunis', 'Africa/Tunis (%s:00)', $xRegion),
|
||||
array('America/Panama', 'America/Panama (%s:00)', $xRegion),
|
||||
array('Asia/Jerusalem', 'Asia/Jerusalem (%s:00)', $xRegion),
|
||||
array('Atlantic/Canary', 'Atlantic/Canary (%s:00)', $xRegion),
|
||||
array('Australia/Perth', 'Australia/Perth (%s:00)', $xRegion),
|
||||
array('Europe/Zurich', 'Europe/Zurich (%s:00)', $xRegion),
|
||||
array('Pacific/Tahiti', 'Pacific/Tahiti (%s:00)', $xRegion),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providePeriods
|
||||
*/
|
||||
public function testDumpPeriod($start, $interval, $end, $options, $expected)
|
||||
{
|
||||
if (defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), is_int($end) ? $end : new \DateTime($end), $options);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
DatePeriod {
|
||||
period: $expected
|
||||
%A}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $p);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providePeriods
|
||||
*/
|
||||
public function testCastPeriod($start, $interval, $end, $options, $xPeriod, $xDates)
|
||||
{
|
||||
if (defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), is_int($end) ? $end : new \DateTime($end), $options);
|
||||
$stub = new Stub();
|
||||
|
||||
$cast = DateCaster::castPeriod($p, array(), $stub, false, 0);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
array:1 [
|
||||
"\\x00~\\x00period" => $xPeriod
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpEquals($xDump, $cast);
|
||||
|
||||
$xDump = <<<EODUMP
|
||||
Symfony\Component\VarDumper\Caster\ConstStub {
|
||||
+type: 1
|
||||
+class: "$xPeriod"
|
||||
+value: "%A$xDates%A"
|
||||
+cut: 0
|
||||
+handle: 0
|
||||
+refCount: 0
|
||||
+position: 0
|
||||
+attr: []
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $cast["\0~\0period"]);
|
||||
}
|
||||
|
||||
public function providePeriods()
|
||||
{
|
||||
$i = new \DateInterval('PT0S');
|
||||
$ms = \PHP_VERSION_ID >= 70100 && isset($i->f) ? '.0' : '';
|
||||
|
||||
$periods = array(
|
||||
array('2017-01-01', 'P1D', '2017-01-03', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02'),
|
||||
array('2017-01-01', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01%a2) 2017-01-02'),
|
||||
|
||||
array('2017-01-01', 'P1D', '2017-01-04', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-04 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'),
|
||||
array('2017-01-01', 'P1D', 2, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 3 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03'),
|
||||
|
||||
array('2017-01-01', 'P1D', '2017-01-05', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-05 00:00:00.0', '1) 2017-01-01%a2) 2017-01-02%a1 more'),
|
||||
array('2017-01-01', 'P1D', 3, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 4 time/s', '1) 2017-01-01%a2) 2017-01-02%a3) 2017-01-03%a1 more'),
|
||||
|
||||
array('2017-01-01', 'P1D', '2017-01-21', 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) to 2017-01-21 00:00:00.0', '1) 2017-01-01%a17 more'),
|
||||
array('2017-01-01', 'P1D', 19, 0, 'every + 1d, from 2017-01-01 00:00:00.0 (included) recurring 20 time/s', '1) 2017-01-01%a17 more'),
|
||||
|
||||
array('2017-01-01 01:00:00', 'P1D', '2017-01-03 01:00:00', 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) to 2017-01-03 01:00:00.0', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'),
|
||||
array('2017-01-01 01:00:00', 'P1D', 1, 0, 'every + 1d, from 2017-01-01 01:00:00.0 (included) recurring 2 time/s', '1) 2017-01-01 01:00:00.0%a2) 2017-01-02 01:00:00.0'),
|
||||
|
||||
array('2017-01-01', 'P1DT1H', '2017-01-03', 0, "every + 1d 01:00:00$ms, from 2017-01-01 00:00:00.0 (included) to 2017-01-03 00:00:00.0", '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'),
|
||||
array('2017-01-01', 'P1DT1H', 1, 0, "every + 1d 01:00:00$ms, from 2017-01-01 00:00:00.0 (included) recurring 2 time/s", '1) 2017-01-01 00:00:00.0%a2) 2017-01-02 01:00:00.0'),
|
||||
|
||||
array('2017-01-01', 'P1D', '2017-01-04', \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) to 2017-01-04 00:00:00.0', '1) 2017-01-02%a2) 2017-01-03'),
|
||||
array('2017-01-01', 'P1D', 2, \DatePeriod::EXCLUDE_START_DATE, 'every + 1d, from 2017-01-01 00:00:00.0 (excluded) recurring 2 time/s', '1) 2017-01-02%a2) 2017-01-03'),
|
||||
);
|
||||
|
||||
if (\PHP_VERSION_ID < 70107) {
|
||||
array_walk($periods, function (&$i) { $i[5] = ''; });
|
||||
}
|
||||
|
||||
return $periods;
|
||||
}
|
||||
|
||||
private function createInterval($intervalSpec, $ms, $invert)
|
||||
{
|
||||
$interval = new \DateInterval($intervalSpec);
|
||||
if (\PHP_VERSION_ID >= 70100 && isset($interval->f)) {
|
||||
$interval->f = $ms;
|
||||
}
|
||||
$interval->invert = $invert;
|
||||
|
||||
return $interval;
|
||||
}
|
||||
}
|
226
vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php
vendored
Normal file
226
vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php
vendored
Normal file
|
@ -0,0 +1,226 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Caster;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Caster\ExceptionCaster;
|
||||
use Symfony\Component\VarDumper\Caster\FrameStub;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
class ExceptionCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
private function getTestException($msg, &$ref = null)
|
||||
{
|
||||
return new \Exception(''.$msg);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
ExceptionCaster::$srcContext = 1;
|
||||
ExceptionCaster::$traceArgs = true;
|
||||
}
|
||||
|
||||
public function testDefaultSettings()
|
||||
{
|
||||
$ref = array('foo');
|
||||
$e = $this->getTestException('foo', $ref);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Exception {
|
||||
#message: "foo"
|
||||
#code: 0
|
||||
#file: "%sExceptionCasterTest.php"
|
||||
#line: 28
|
||||
trace: {
|
||||
%s%eTests%eCaster%eExceptionCasterTest.php:28 {
|
||||
› {
|
||||
› return new \Exception(''.$msg);
|
||||
› }
|
||||
}
|
||||
%s%eTests%eCaster%eExceptionCasterTest.php:40 { …}
|
||||
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testDefaultSettings() {}
|
||||
%A
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $e);
|
||||
$this->assertSame(array('foo'), $ref);
|
||||
}
|
||||
|
||||
public function testSeek()
|
||||
{
|
||||
$e = $this->getTestException(2);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
{
|
||||
%s%eTests%eCaster%eExceptionCasterTest.php:28 {
|
||||
› {
|
||||
› return new \Exception(''.$msg);
|
||||
› }
|
||||
}
|
||||
%s%eTests%eCaster%eExceptionCasterTest.php:65 { …}
|
||||
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testSeek() {}
|
||||
%A
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $this->getDump($e, 'trace'));
|
||||
}
|
||||
|
||||
public function testNoArgs()
|
||||
{
|
||||
$e = $this->getTestException(1);
|
||||
ExceptionCaster::$traceArgs = false;
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Exception {
|
||||
#message: "1"
|
||||
#code: 0
|
||||
#file: "%sExceptionCasterTest.php"
|
||||
#line: 28
|
||||
trace: {
|
||||
%sExceptionCasterTest.php:28 {
|
||||
› {
|
||||
› return new \Exception(''.$msg);
|
||||
› }
|
||||
}
|
||||
%s%eTests%eCaster%eExceptionCasterTest.php:84 { …}
|
||||
Symfony\Component\VarDumper\Tests\Caster\ExceptionCasterTest->testNoArgs() {}
|
||||
%A
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $e);
|
||||
}
|
||||
|
||||
public function testNoSrcContext()
|
||||
{
|
||||
$e = $this->getTestException(1);
|
||||
ExceptionCaster::$srcContext = -1;
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Exception {
|
||||
#message: "1"
|
||||
#code: 0
|
||||
#file: "%sExceptionCasterTest.php"
|
||||
#line: 28
|
||||
trace: {
|
||||
%s%eTests%eCaster%eExceptionCasterTest.php:28
|
||||
%s%eTests%eCaster%eExceptionCasterTest.php:%d
|
||||
%A
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $e);
|
||||
}
|
||||
|
||||
public function testHtmlDump()
|
||||
{
|
||||
$e = $this->getTestException(1);
|
||||
ExceptionCaster::$srcContext = -1;
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$cloner->setMaxItems(1);
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$dump = $dumper->dump($cloner->cloneVar($e)->withRefHandles(false), true);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
<foo></foo><bar><span class=sf-dump-note>Exception</span> {<samp>
|
||||
#<span class=sf-dump-protected title="Protected property">message</span>: "<span class=sf-dump-str>1</span>"
|
||||
#<span class=sf-dump-protected title="Protected property">code</span>: <span class=sf-dump-num>0</span>
|
||||
#<span class=sf-dump-protected title="Protected property">file</span>: "<span class=sf-dump-str title="%sExceptionCasterTest.php
|
||||
%d characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-path">%s%eVarDumper</span><span class=sf-dump-ellipsis>%e</span>Tests%eCaster%eExceptionCasterTest.php</span>"
|
||||
#<span class=sf-dump-protected title="Protected property">line</span>: <span class=sf-dump-num>28</span>
|
||||
<span class=sf-dump-meta>trace</span>: {<samp>
|
||||
<span class=sf-dump-meta title="%sExceptionCasterTest.php
|
||||
Stack level %d."><span class="sf-dump-ellipsis sf-dump-ellipsis-path">%s%eVarDumper</span><span class=sf-dump-ellipsis>%e</span>Tests%eCaster%eExceptionCasterTest.php</span>:<span class=sf-dump-num>28</span>
|
||||
…%d
|
||||
</samp>}
|
||||
</samp>}
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires function Twig\Template::getSourceContext
|
||||
*/
|
||||
public function testFrameWithTwig()
|
||||
{
|
||||
require_once dirname(__DIR__).'/Fixtures/Twig.php';
|
||||
|
||||
$f = array(
|
||||
new FrameStub(array(
|
||||
'file' => dirname(__DIR__).'/Fixtures/Twig.php',
|
||||
'line' => 20,
|
||||
'class' => '__TwigTemplate_VarDumperFixture_u75a09',
|
||||
)),
|
||||
new FrameStub(array(
|
||||
'file' => dirname(__DIR__).'/Fixtures/Twig.php',
|
||||
'line' => 21,
|
||||
'class' => '__TwigTemplate_VarDumperFixture_u75a09',
|
||||
'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, __FILE__),
|
||||
)),
|
||||
);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:2 [
|
||||
0 => {
|
||||
class: "__TwigTemplate_VarDumperFixture_u75a09"
|
||||
src: {
|
||||
%sTwig.php:1 {
|
||||
›
|
||||
› foo bar
|
||||
› twig source
|
||||
}
|
||||
}
|
||||
}
|
||||
1 => {
|
||||
class: "__TwigTemplate_VarDumperFixture_u75a09"
|
||||
object: __TwigTemplate_VarDumperFixture_u75a09 {
|
||||
%A
|
||||
}
|
||||
src: {
|
||||
%sExceptionCasterTest.php:2 {
|
||||
› foo bar
|
||||
› twig source
|
||||
›
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $f);
|
||||
}
|
||||
|
||||
public function testExcludeVerbosity()
|
||||
{
|
||||
$e = $this->getTestException('foo');
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Exception {
|
||||
#message: "foo"
|
||||
#code: 0
|
||||
#file: "%sExceptionCasterTest.php"
|
||||
#line: 28
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $e, Caster::EXCLUDE_VERBOSE);
|
||||
}
|
||||
}
|
64
vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php
vendored
Normal file
64
vendor/symfony/var-dumper/Tests/Caster/PdoCasterTest.php
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Caster;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Caster\PdoCaster;
|
||||
use Symfony\Component\VarDumper\Cloner\Stub;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class PdoCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @requires extension pdo_sqlite
|
||||
*/
|
||||
public function testCastPdo()
|
||||
{
|
||||
$pdo = new \PDO('sqlite::memory:');
|
||||
$pdo->setAttribute(\PDO::ATTR_STATEMENT_CLASS, array('PDOStatement', array($pdo)));
|
||||
|
||||
$cast = PdoCaster::castPdo($pdo, array(), new Stub(), false);
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\VarDumper\Caster\EnumStub', $cast["\0~\0attributes"]);
|
||||
|
||||
$attr = $cast["\0~\0attributes"] = $cast["\0~\0attributes"]->value;
|
||||
$this->assertInstanceOf('Symfony\Component\VarDumper\Caster\ConstStub', $attr['CASE']);
|
||||
$this->assertSame('NATURAL', $attr['CASE']->class);
|
||||
$this->assertSame('BOTH', $attr['DEFAULT_FETCH_MODE']->class);
|
||||
|
||||
$xDump = <<<'EODUMP'
|
||||
array:2 [
|
||||
"\x00~\x00inTransaction" => false
|
||||
"\x00~\x00attributes" => array:9 [
|
||||
"CASE" => NATURAL
|
||||
"ERRMODE" => SILENT
|
||||
"PERSISTENT" => false
|
||||
"DRIVER_NAME" => "sqlite"
|
||||
"ORACLE_NULLS" => NATURAL
|
||||
"CLIENT_VERSION" => "%s"
|
||||
"SERVER_VERSION" => "%s"
|
||||
"STATEMENT_CLASS" => array:%d [
|
||||
0 => "PDOStatement"%A
|
||||
]
|
||||
"DEFAULT_FETCH_MODE" => BOTH
|
||||
]
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($xDump, $cast);
|
||||
}
|
||||
}
|
84
vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php
vendored
Normal file
84
vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php
vendored
Normal file
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Caster;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
* @requires extension redis
|
||||
*/
|
||||
class RedisCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function testNotConnected()
|
||||
{
|
||||
$redis = new \Redis();
|
||||
|
||||
if (defined('HHVM_VERSION_ID')) {
|
||||
$xCast = <<<'EODUMP'
|
||||
Redis {
|
||||
#host: ""
|
||||
%A
|
||||
}
|
||||
EODUMP;
|
||||
} else {
|
||||
$xCast = <<<'EODUMP'
|
||||
Redis {
|
||||
isConnected: false
|
||||
}
|
||||
EODUMP;
|
||||
}
|
||||
|
||||
$this->assertDumpMatchesFormat($xCast, $redis);
|
||||
}
|
||||
|
||||
public function testConnected()
|
||||
{
|
||||
$redis = new \Redis();
|
||||
if (!@$redis->connect('127.0.0.1')) {
|
||||
$e = error_get_last();
|
||||
self::markTestSkipped($e['message']);
|
||||
}
|
||||
|
||||
if (defined('HHVM_VERSION_ID')) {
|
||||
$xCast = <<<'EODUMP'
|
||||
Redis {
|
||||
#host: "127.0.0.1"
|
||||
%A
|
||||
}
|
||||
EODUMP;
|
||||
} else {
|
||||
$xCast = <<<'EODUMP'
|
||||
Redis {%A
|
||||
isConnected: true
|
||||
host: "127.0.0.1"
|
||||
port: 6379
|
||||
auth: null
|
||||
dbNum: 0
|
||||
timeout: 0.0
|
||||
persistentId: null
|
||||
options: {
|
||||
READ_TIMEOUT: 0.0
|
||||
SERIALIZER: NONE
|
||||
PREFIX: null
|
||||
SCAN: NORETRY
|
||||
}
|
||||
}
|
||||
EODUMP;
|
||||
}
|
||||
|
||||
$this->assertDumpMatchesFormat($xCast, $redis);
|
||||
}
|
||||
}
|
242
vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php
vendored
Normal file
242
vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php
vendored
Normal file
|
@ -0,0 +1,242 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Caster;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
use Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo;
|
||||
use Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class ReflectionCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function testReflectionCaster()
|
||||
{
|
||||
$var = new \ReflectionClass('ReflectionClass');
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
ReflectionClass {
|
||||
+name: "ReflectionClass"
|
||||
%Aimplements: array:%d [
|
||||
0 => "Reflector"
|
||||
%A]
|
||||
constants: array:3 [
|
||||
"IS_IMPLICIT_ABSTRACT" => 16
|
||||
"IS_EXPLICIT_ABSTRACT" => 32
|
||||
"IS_FINAL" => %d
|
||||
]
|
||||
properties: array:%d [
|
||||
"name" => ReflectionProperty {
|
||||
%A +name: "name"
|
||||
+class: "ReflectionClass"
|
||||
%A modifiers: "public"
|
||||
}
|
||||
%A]
|
||||
methods: array:%d [
|
||||
%A
|
||||
"export" => ReflectionMethod {
|
||||
+name: "export"
|
||||
+class: "ReflectionClass"
|
||||
%A parameters: {
|
||||
$%s: ReflectionParameter {
|
||||
%A position: 0
|
||||
%A
|
||||
}
|
||||
EOTXT
|
||||
, $var
|
||||
);
|
||||
}
|
||||
|
||||
public function testClosureCaster()
|
||||
{
|
||||
$a = $b = 123;
|
||||
$var = function ($x) use ($a, &$b) {};
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
Closure {
|
||||
%Aparameters: {
|
||||
\$x: {}
|
||||
}
|
||||
use: {
|
||||
\$a: 123
|
||||
\$b: & 123
|
||||
}
|
||||
file: "%sReflectionCasterTest.php"
|
||||
line: "68 to 68"
|
||||
}
|
||||
EOTXT
|
||||
, $var
|
||||
);
|
||||
}
|
||||
|
||||
public function testClosureCasterExcludingVerbosity()
|
||||
{
|
||||
$var = function () {};
|
||||
|
||||
$expectedDump = <<<EOTXT
|
||||
Closure {
|
||||
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
|
||||
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
|
||||
}
|
||||
EOTXT;
|
||||
|
||||
$this->assertDumpEquals($expectedDump, $var, Caster::EXCLUDE_VERBOSE);
|
||||
}
|
||||
|
||||
public function testReflectionParameter()
|
||||
{
|
||||
$var = new \ReflectionParameter(__NAMESPACE__.'\reflectionParameterFixture', 0);
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
ReflectionParameter {
|
||||
+name: "arg1"
|
||||
position: 0
|
||||
typeHint: "Symfony\Component\VarDumper\Tests\Fixtures\NotLoadableClass"
|
||||
default: null
|
||||
}
|
||||
EOTXT
|
||||
, $var
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 7.0
|
||||
*/
|
||||
public function testReflectionParameterScalar()
|
||||
{
|
||||
$f = eval('return function (int $a) {};');
|
||||
$var = new \ReflectionParameter($f, 0);
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
ReflectionParameter {
|
||||
+name: "a"
|
||||
position: 0
|
||||
typeHint: "int"
|
||||
}
|
||||
EOTXT
|
||||
, $var
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 7.0
|
||||
*/
|
||||
public function testReturnType()
|
||||
{
|
||||
$f = eval('return function ():int {};');
|
||||
$line = __LINE__ - 1;
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
Closure {
|
||||
returnType: "int"
|
||||
class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest"
|
||||
this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …}
|
||||
file: "%sReflectionCasterTest.php($line) : eval()'d code"
|
||||
line: "1 to 1"
|
||||
}
|
||||
EOTXT
|
||||
, $f
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires PHP 7.0
|
||||
*/
|
||||
public function testGenerator()
|
||||
{
|
||||
if (extension_loaded('xdebug')) {
|
||||
$this->markTestSkipped('xdebug is active');
|
||||
}
|
||||
|
||||
$generator = new GeneratorDemo();
|
||||
$generator = $generator->baz();
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Generator {
|
||||
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
|
||||
executing: {
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo->baz() {
|
||||
%sGeneratorDemo.php:14 {
|
||||
› {
|
||||
› yield from bar();
|
||||
› }
|
||||
}
|
||||
}
|
||||
}
|
||||
closed: false
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $generator);
|
||||
|
||||
foreach ($generator as $v) {
|
||||
break;
|
||||
}
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:2 [
|
||||
0 => ReflectionGenerator {
|
||||
this: Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo { …}
|
||||
trace: {
|
||||
%s%eTests%eFixtures%eGeneratorDemo.php:9 {
|
||||
› {
|
||||
› yield 1;
|
||||
› }
|
||||
}
|
||||
%s%eTests%eFixtures%eGeneratorDemo.php:20 { …}
|
||||
%s%eTests%eFixtures%eGeneratorDemo.php:14 { …}
|
||||
}
|
||||
closed: false
|
||||
}
|
||||
1 => Generator {
|
||||
executing: {
|
||||
Symfony\Component\VarDumper\Tests\Fixtures\GeneratorDemo::foo() {
|
||||
%sGeneratorDemo.php:10 {
|
||||
› yield 1;
|
||||
› }
|
||||
›
|
||||
}
|
||||
}
|
||||
}
|
||||
closed: false
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$r = new \ReflectionGenerator($generator);
|
||||
$this->assertDumpMatchesFormat($expectedDump, array($r, $r->getExecutingGenerator()));
|
||||
|
||||
foreach ($generator as $v) {
|
||||
}
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
Generator {
|
||||
closed: true
|
||||
}
|
||||
EODUMP;
|
||||
$this->assertDumpMatchesFormat($expectedDump, $generator);
|
||||
}
|
||||
}
|
||||
|
||||
function reflectionParameterFixture(NotLoadableClass $arg1 = null, $arg2)
|
||||
{
|
||||
}
|
147
vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php
vendored
Normal file
147
vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php
vendored
Normal file
|
@ -0,0 +1,147 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Caster;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @author Grégoire Pineau <lyrixx@lyrixx.info>
|
||||
*/
|
||||
class SplCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function getCastFileInfoTests()
|
||||
{
|
||||
return array(
|
||||
array(__FILE__, <<<'EOTXT'
|
||||
SplFileInfo {
|
||||
%Apath: "%sCaster"
|
||||
filename: "SplCasterTest.php"
|
||||
basename: "SplCasterTest.php"
|
||||
pathname: "%sSplCasterTest.php"
|
||||
extension: "php"
|
||||
realPath: "%sSplCasterTest.php"
|
||||
aTime: %s-%s-%d %d:%d:%d
|
||||
mTime: %s-%s-%d %d:%d:%d
|
||||
cTime: %s-%s-%d %d:%d:%d
|
||||
inode: %d
|
||||
size: %d
|
||||
perms: 0%d
|
||||
owner: %d
|
||||
group: %d
|
||||
type: "file"
|
||||
writable: true
|
||||
readable: true
|
||||
executable: false
|
||||
file: true
|
||||
dir: false
|
||||
link: false
|
||||
%A}
|
||||
EOTXT
|
||||
),
|
||||
array('https://google.com/about', <<<'EOTXT'
|
||||
SplFileInfo {
|
||||
%Apath: "https://google.com"
|
||||
filename: "about"
|
||||
basename: "about"
|
||||
pathname: "https://google.com/about"
|
||||
extension: ""
|
||||
realPath: false
|
||||
%A}
|
||||
EOTXT
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/** @dataProvider getCastFileInfoTests */
|
||||
public function testCastFileInfo($file, $dump)
|
||||
{
|
||||
$this->assertDumpMatchesFormat($dump, new \SplFileInfo($file));
|
||||
}
|
||||
|
||||
public function testCastFileObject()
|
||||
{
|
||||
$var = new \SplFileObject(__FILE__);
|
||||
$var->setFlags(\SplFileObject::DROP_NEW_LINE | \SplFileObject::SKIP_EMPTY);
|
||||
$dump = <<<'EOTXT'
|
||||
SplFileObject {
|
||||
%Apath: "%sCaster"
|
||||
filename: "SplCasterTest.php"
|
||||
basename: "SplCasterTest.php"
|
||||
pathname: "%sSplCasterTest.php"
|
||||
extension: "php"
|
||||
realPath: "%sSplCasterTest.php"
|
||||
aTime: %s-%s-%d %d:%d:%d
|
||||
mTime: %s-%s-%d %d:%d:%d
|
||||
cTime: %s-%s-%d %d:%d:%d
|
||||
inode: %d
|
||||
size: %d
|
||||
perms: 0%d
|
||||
owner: %d
|
||||
group: %d
|
||||
type: "file"
|
||||
writable: true
|
||||
readable: true
|
||||
executable: false
|
||||
file: true
|
||||
dir: false
|
||||
link: false
|
||||
%AcsvControl: array:%d [
|
||||
0 => ","
|
||||
1 => """
|
||||
%A]
|
||||
flags: DROP_NEW_LINE|SKIP_EMPTY
|
||||
maxLineLen: 0
|
||||
fstat: array:26 [
|
||||
"dev" => %d
|
||||
"ino" => %d
|
||||
"nlink" => %d
|
||||
"rdev" => 0
|
||||
"blksize" => %i
|
||||
"blocks" => %i
|
||||
…20
|
||||
]
|
||||
eof: false
|
||||
key: 0
|
||||
}
|
||||
EOTXT;
|
||||
$this->assertDumpMatchesFormat($dump, $var);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideCastSplDoublyLinkedList
|
||||
*/
|
||||
public function testCastSplDoublyLinkedList($modeValue, $modeDump)
|
||||
{
|
||||
$var = new \SplDoublyLinkedList();
|
||||
$var->setIteratorMode($modeValue);
|
||||
$dump = <<<EOTXT
|
||||
SplDoublyLinkedList {
|
||||
%Amode: $modeDump
|
||||
dllist: []
|
||||
}
|
||||
EOTXT;
|
||||
$this->assertDumpMatchesFormat($dump, $var);
|
||||
}
|
||||
|
||||
public function provideCastSplDoublyLinkedList()
|
||||
{
|
||||
return array(
|
||||
array(\SplDoublyLinkedList::IT_MODE_FIFO, 'IT_MODE_FIFO | IT_MODE_KEEP'),
|
||||
array(\SplDoublyLinkedList::IT_MODE_LIFO, 'IT_MODE_LIFO | IT_MODE_KEEP'),
|
||||
array(\SplDoublyLinkedList::IT_MODE_FIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_FIFO | IT_MODE_DELETE'),
|
||||
array(\SplDoublyLinkedList::IT_MODE_LIFO | \SplDoublyLinkedList::IT_MODE_DELETE, 'IT_MODE_LIFO | IT_MODE_DELETE'),
|
||||
);
|
||||
}
|
||||
}
|
192
vendor/symfony/var-dumper/Tests/Caster/StubCasterTest.php
vendored
Normal file
192
vendor/symfony/var-dumper/Tests/Caster/StubCasterTest.php
vendored
Normal file
|
@ -0,0 +1,192 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Caster;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Caster\ArgsStub;
|
||||
use Symfony\Component\VarDumper\Caster\ClassStub;
|
||||
use Symfony\Component\VarDumper\Caster\LinkStub;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
use Symfony\Component\VarDumper\Tests\Fixtures\FooInterface;
|
||||
|
||||
class StubCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function testArgsStubWithDefaults($foo = 234, $bar = 456)
|
||||
{
|
||||
$args = array(new ArgsStub(array(123), __FUNCTION__, __CLASS__));
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:1 [
|
||||
0 => {
|
||||
$foo: 123
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $args);
|
||||
}
|
||||
|
||||
public function testArgsStubWithExtraArgs($foo = 234)
|
||||
{
|
||||
$args = array(new ArgsStub(array(123, 456), __FUNCTION__, __CLASS__));
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:1 [
|
||||
0 => {
|
||||
$foo: 123
|
||||
...: {
|
||||
456
|
||||
}
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $args);
|
||||
}
|
||||
|
||||
public function testArgsStubNoParamWithExtraArgs()
|
||||
{
|
||||
$args = array(new ArgsStub(array(123), __FUNCTION__, __CLASS__));
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:1 [
|
||||
0 => {
|
||||
123
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $args);
|
||||
}
|
||||
|
||||
public function testArgsStubWithClosure()
|
||||
{
|
||||
$args = array(new ArgsStub(array(123), '{closure}', null));
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
array:1 [
|
||||
0 => {
|
||||
123
|
||||
}
|
||||
]
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $args);
|
||||
}
|
||||
|
||||
public function testLinkStub()
|
||||
{
|
||||
$var = array(new LinkStub(__CLASS__, 0, __FILE__));
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$dumper->setDisplayOptions(array('fileLinkFormat' => '%f:%l'));
|
||||
$dump = $dumper->dump($cloner->cloneVar($var), true);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
||||
<span class=sf-dump-index>0</span> => "<a href="%sStubCasterTest.php:0" rel="noopener noreferrer"><span class=sf-dump-str title="55 characters">Symfony\Component\VarDumper\Tests\Caster\StubCasterTest</span></a>"
|
||||
</samp>]
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
|
||||
public function testLinkStubWithNoFileLink()
|
||||
{
|
||||
$var = array(new LinkStub('example.com', 0, 'http://example.com'));
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$dumper->setDisplayOptions(array('fileLinkFormat' => '%f:%l'));
|
||||
$dump = $dumper->dump($cloner->cloneVar($var), true);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
||||
<span class=sf-dump-index>0</span> => "<a href="http://example.com" target="_blank" rel="noopener noreferrer"><span class=sf-dump-str title="11 characters">example.com</span></a>"
|
||||
</samp>]
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
|
||||
public function testClassStub()
|
||||
{
|
||||
$var = array(new ClassStub('hello', array(FooInterface::class, 'foo')));
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
||||
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:10" rel="noopener noreferrer"><span class=sf-dump-str title="5 characters">hello</span></a>"
|
||||
</samp>]
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
|
||||
public function testClassStubWithNotExistingClass()
|
||||
{
|
||||
$var = array(new ClassStub(NotExisting::class));
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$dump = $dumper->dump($cloner->cloneVar($var), true);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
||||
<span class=sf-dump-index>0</span> => "<span class=sf-dump-str title="Symfony\Component\VarDumper\Tests\Caster\NotExisting
|
||||
52 characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-class">Symfony\Component\VarDumper\Tests\Caster</span><span class=sf-dump-ellipsis>\</span>NotExisting</span>"
|
||||
</samp>]
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
|
||||
public function testClassStubWithNotExistingMethod()
|
||||
{
|
||||
$var = array(new ClassStub('hello', array(FooInterface::class, 'missing')));
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$dump = $dumper->dump($cloner->cloneVar($var), true, array('fileLinkFormat' => '%f:%l'));
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
<foo></foo><bar><span class=sf-dump-note>array:1</span> [<samp>
|
||||
<span class=sf-dump-index>0</span> => "<a href="%sFooInterface.php:5" rel="noopener noreferrer"><span class=sf-dump-str title="5 characters">hello</span></a>"
|
||||
</samp>]
|
||||
</bar>
|
||||
EODUMP;
|
||||
|
||||
$this->assertStringMatchesFormat($expectedDump, $dump);
|
||||
}
|
||||
}
|
248
vendor/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php
vendored
Normal file
248
vendor/symfony/var-dumper/Tests/Caster/XmlReaderCasterTest.php
vendored
Normal file
|
@ -0,0 +1,248 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Caster;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
/**
|
||||
* @author Baptiste Clavié <clavie.b@gmail.com>
|
||||
*/
|
||||
class XmlReaderCasterTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
/** @var \XmlReader */
|
||||
private $reader;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->reader = new \XmlReader();
|
||||
$this->reader->open(__DIR__.'/../Fixtures/xml_reader.xml');
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->reader->close();
|
||||
}
|
||||
|
||||
public function testParserProperty()
|
||||
{
|
||||
$this->reader->setParserProperty(\XMLReader::SUBST_ENTITIES, true);
|
||||
|
||||
$expectedDump = <<<'EODUMP'
|
||||
XMLReader {
|
||||
+nodeType: NONE
|
||||
parserProperties: {
|
||||
SUBST_ENTITIES: true
|
||||
…3
|
||||
}
|
||||
…12
|
||||
}
|
||||
EODUMP;
|
||||
|
||||
$this->assertDumpMatchesFormat($expectedDump, $this->reader);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideNodes
|
||||
*/
|
||||
public function testNodes($seek, $expectedDump)
|
||||
{
|
||||
while ($seek--) {
|
||||
$this->reader->read();
|
||||
}
|
||||
$this->assertDumpMatchesFormat($expectedDump, $this->reader);
|
||||
}
|
||||
|
||||
public function provideNodes()
|
||||
{
|
||||
return array(
|
||||
array(0, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+nodeType: NONE
|
||||
…13
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(1, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "foo"
|
||||
+nodeType: ELEMENT
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…11
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(2, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "#text"
|
||||
+nodeType: SIGNIFICANT_WHITESPACE
|
||||
+depth: 1
|
||||
+value: """
|
||||
\n
|
||||
|
||||
"""
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(3, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: ELEMENT
|
||||
+depth: 1
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…10
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(4, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: END_ELEMENT
|
||||
+depth: 1
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…10
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(6, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: ELEMENT
|
||||
+depth: 1
|
||||
+isEmptyElement: true
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(9, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "#text"
|
||||
+nodeType: TEXT
|
||||
+depth: 2
|
||||
+value: "With text"
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(12, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: ELEMENT
|
||||
+depth: 1
|
||||
+attributeCount: 2
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(13, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: END_ELEMENT
|
||||
+depth: 1
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…10
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(15, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "bar"
|
||||
+nodeType: ELEMENT
|
||||
+depth: 1
|
||||
+attributeCount: 1
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(16, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "#text"
|
||||
+nodeType: SIGNIFICANT_WHITESPACE
|
||||
+depth: 2
|
||||
+value: """
|
||||
\n
|
||||
|
||||
"""
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(17, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "baz"
|
||||
+prefix: "baz"
|
||||
+nodeType: ELEMENT
|
||||
+depth: 2
|
||||
+namespaceURI: "http://symfony.com"
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…8
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(18, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "baz"
|
||||
+prefix: "baz"
|
||||
+nodeType: END_ELEMENT
|
||||
+depth: 2
|
||||
+namespaceURI: "http://symfony.com"
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…8
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(19, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "#text"
|
||||
+nodeType: SIGNIFICANT_WHITESPACE
|
||||
+depth: 2
|
||||
+value: """
|
||||
\n
|
||||
|
||||
"""
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(21, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "#text"
|
||||
+nodeType: SIGNIFICANT_WHITESPACE
|
||||
+depth: 1
|
||||
+value: "\n"
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…9
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
array(22, <<<'EODUMP'
|
||||
XMLReader {
|
||||
+localName: "foo"
|
||||
+nodeType: END_ELEMENT
|
||||
+baseURI: "%sxml_reader.xml"
|
||||
…11
|
||||
}
|
||||
EODUMP
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
115
vendor/symfony/var-dumper/Tests/Cloner/DataTest.php
vendored
Normal file
115
vendor/symfony/var-dumper/Tests/Cloner/DataTest.php
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Cloner;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Caster\Caster;
|
||||
use Symfony\Component\VarDumper\Caster\ClassStub;
|
||||
use Symfony\Component\VarDumper\Cloner\Data;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
class DataTest extends TestCase
|
||||
{
|
||||
public function testBasicData()
|
||||
{
|
||||
$values = array(1 => 123, 4.5, 'abc', null, false);
|
||||
$data = $this->cloneVar($values);
|
||||
$clonedValues = array();
|
||||
|
||||
$this->assertInstanceOf(Data::class, $data);
|
||||
$this->assertCount(count($values), $data);
|
||||
$this->assertFalse(isset($data->{0}));
|
||||
$this->assertFalse(isset($data[0]));
|
||||
|
||||
foreach ($data as $k => $v) {
|
||||
$this->assertTrue(isset($data->{$k}));
|
||||
$this->assertTrue(isset($data[$k]));
|
||||
$this->assertSame(gettype($values[$k]), $data->seek($k)->getType());
|
||||
$this->assertSame($values[$k], $data->seek($k)->getValue());
|
||||
$this->assertSame($values[$k], $data->{$k});
|
||||
$this->assertSame($values[$k], $data[$k]);
|
||||
$this->assertSame((string) $values[$k], (string) $data->seek($k));
|
||||
|
||||
$clonedValues[$k] = $v->getValue();
|
||||
}
|
||||
|
||||
$this->assertSame($values, $clonedValues);
|
||||
}
|
||||
|
||||
public function testObject()
|
||||
{
|
||||
$data = $this->cloneVar(new \Exception('foo'));
|
||||
|
||||
$this->assertSame('Exception', $data->getType());
|
||||
|
||||
$this->assertSame('foo', $data->message);
|
||||
$this->assertSame('foo', $data->{Caster::PREFIX_PROTECTED.'message'});
|
||||
|
||||
$this->assertSame('foo', $data['message']);
|
||||
$this->assertSame('foo', $data[Caster::PREFIX_PROTECTED.'message']);
|
||||
|
||||
$this->assertStringMatchesFormat('Exception (count=%d)', (string) $data);
|
||||
}
|
||||
|
||||
public function testArray()
|
||||
{
|
||||
$values = array(array(), array(123));
|
||||
$data = $this->cloneVar($values);
|
||||
|
||||
$this->assertSame($values, $data->getValue(true));
|
||||
|
||||
$children = $data->getValue();
|
||||
|
||||
$this->assertInternalType('array', $children);
|
||||
|
||||
$this->assertInstanceOf(Data::class, $children[0]);
|
||||
$this->assertInstanceOf(Data::class, $children[1]);
|
||||
|
||||
$this->assertEquals($children[0], $data[0]);
|
||||
$this->assertEquals($children[1], $data[1]);
|
||||
|
||||
$this->assertSame($values[0], $children[0]->getValue(true));
|
||||
$this->assertSame($values[1], $children[1]->getValue(true));
|
||||
}
|
||||
|
||||
public function testStub()
|
||||
{
|
||||
$data = $this->cloneVar(array(new ClassStub('stdClass')));
|
||||
$data = $data[0];
|
||||
|
||||
$this->assertSame('string', $data->getType());
|
||||
$this->assertSame('stdClass', $data->getValue());
|
||||
$this->assertSame('stdClass', (string) $data);
|
||||
}
|
||||
|
||||
public function testHardRefs()
|
||||
{
|
||||
$values = array(array());
|
||||
$values[1] = &$values[0];
|
||||
$values[2][0] = &$values[2];
|
||||
|
||||
$data = $this->cloneVar($values);
|
||||
|
||||
$this->assertSame(array(), $data[0]->getValue());
|
||||
$this->assertSame(array(), $data[1]->getValue());
|
||||
$this->assertEquals(array($data[2]->getValue()), $data[2]->getValue(true));
|
||||
|
||||
$this->assertSame('array (count=3)', (string) $data);
|
||||
}
|
||||
|
||||
private function cloneVar($value)
|
||||
{
|
||||
$cloner = new VarCloner();
|
||||
|
||||
return $cloner->cloneVar($value);
|
||||
}
|
||||
}
|
437
vendor/symfony/var-dumper/Tests/Cloner/VarClonerTest.php
vendored
Normal file
437
vendor/symfony/var-dumper/Tests/Cloner/VarClonerTest.php
vendored
Normal file
|
@ -0,0 +1,437 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Cloner;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class VarClonerTest extends TestCase
|
||||
{
|
||||
public function testMaxIntBoundary()
|
||||
{
|
||||
$data = array(PHP_INT_MAX => 123);
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$clone = $cloner->cloneVar($data);
|
||||
|
||||
$expected = <<<EOTXT
|
||||
Symfony\Component\VarDumper\Cloner\Data Object
|
||||
(
|
||||
[data:Symfony\Component\VarDumper\Cloner\Data:private] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[1] => 1
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[%s] => 123
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
|
||||
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
)
|
||||
|
||||
EOTXT;
|
||||
$this->assertSame(sprintf($expected, PHP_INT_MAX), print_r($clone, true));
|
||||
}
|
||||
|
||||
public function testClone()
|
||||
{
|
||||
$json = json_decode('{"1":{"var":"val"},"2":{"var":"val"}}');
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$clone = $cloner->cloneVar($json);
|
||||
|
||||
$expected = <<<EOTXT
|
||||
Symfony\Component\VarDumper\Cloner\Data Object
|
||||
(
|
||||
[data:Symfony\Component\VarDumper\Cloner\Data:private] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => Symfony\Component\VarDumper\Cloner\Stub Object
|
||||
(
|
||||
[type] => 4
|
||||
[class] => stdClass
|
||||
[value] =>
|
||||
[cut] => 0
|
||||
[handle] => %i
|
||||
[refCount] => 0
|
||||
[position] => 1
|
||||
[attr] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[\000+\0001] => Symfony\Component\VarDumper\Cloner\Stub Object
|
||||
(
|
||||
[type] => 4
|
||||
[class] => stdClass
|
||||
[value] =>
|
||||
[cut] => 0
|
||||
[handle] => %i
|
||||
[refCount] => 0
|
||||
[position] => 2
|
||||
[attr] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[\000+\0002] => Symfony\Component\VarDumper\Cloner\Stub Object
|
||||
(
|
||||
[type] => 4
|
||||
[class] => stdClass
|
||||
[value] =>
|
||||
[cut] => 0
|
||||
[handle] => %i
|
||||
[refCount] => 0
|
||||
[position] => 3
|
||||
[attr] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[\000+\000var] => val
|
||||
)
|
||||
|
||||
[3] => Array
|
||||
(
|
||||
[\000+\000var] => val
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
|
||||
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
)
|
||||
|
||||
EOTXT;
|
||||
$this->assertStringMatchesFormat($expected, print_r($clone, true));
|
||||
}
|
||||
|
||||
public function testLimits()
|
||||
{
|
||||
// Level 0:
|
||||
$data = array(
|
||||
// Level 1:
|
||||
array(
|
||||
// Level 2:
|
||||
array(
|
||||
// Level 3:
|
||||
'Level 3 Item 0',
|
||||
'Level 3 Item 1',
|
||||
'Level 3 Item 2',
|
||||
'Level 3 Item 3',
|
||||
),
|
||||
array(
|
||||
'Level 3 Item 4',
|
||||
'Level 3 Item 5',
|
||||
'Level 3 Item 6',
|
||||
),
|
||||
array(
|
||||
'Level 3 Item 7',
|
||||
),
|
||||
),
|
||||
array(
|
||||
array(
|
||||
'Level 3 Item 8',
|
||||
),
|
||||
'Level 2 Item 0',
|
||||
),
|
||||
array(
|
||||
'Level 2 Item 1',
|
||||
),
|
||||
'Level 1 Item 0',
|
||||
array(
|
||||
// Test setMaxString:
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
||||
'SHORT',
|
||||
),
|
||||
);
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$cloner->setMinDepth(2);
|
||||
$cloner->setMaxItems(5);
|
||||
$cloner->setMaxString(20);
|
||||
$clone = $cloner->cloneVar($data);
|
||||
|
||||
$expected = <<<EOTXT
|
||||
Symfony\Component\VarDumper\Cloner\Data Object
|
||||
(
|
||||
[data:Symfony\Component\VarDumper\Cloner\Data:private] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[2] => 1
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[2] => 2
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[2] => 3
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[2] => 4
|
||||
)
|
||||
|
||||
[3] => Level 1 Item 0
|
||||
[4] => Array
|
||||
(
|
||||
[2] => 5
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[2] => 6
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[0] => 2
|
||||
[2] => 7
|
||||
)
|
||||
|
||||
[2] => Array
|
||||
(
|
||||
[0] => 1
|
||||
[2] => 0
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[3] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => 1
|
||||
[2] => 0
|
||||
)
|
||||
|
||||
[1] => Level 2 Item 0
|
||||
)
|
||||
|
||||
[4] => Array
|
||||
(
|
||||
[0] => Level 2 Item 1
|
||||
)
|
||||
|
||||
[5] => Array
|
||||
(
|
||||
[0] => Symfony\Component\VarDumper\Cloner\Stub Object
|
||||
(
|
||||
[type] => 2
|
||||
[class] => 2
|
||||
[value] => ABCDEFGHIJKLMNOPQRST
|
||||
[cut] => 6
|
||||
[handle] => 0
|
||||
[refCount] => 0
|
||||
[position] => 0
|
||||
[attr] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => SHORT
|
||||
)
|
||||
|
||||
[6] => Array
|
||||
(
|
||||
[0] => Level 3 Item 0
|
||||
[1] => Level 3 Item 1
|
||||
[2] => Level 3 Item 2
|
||||
[3] => Level 3 Item 3
|
||||
)
|
||||
|
||||
[7] => Array
|
||||
(
|
||||
[0] => Level 3 Item 4
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
|
||||
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
)
|
||||
|
||||
EOTXT;
|
||||
$this->assertStringMatchesFormat($expected, print_r($clone, true));
|
||||
}
|
||||
|
||||
public function testJsonCast()
|
||||
{
|
||||
if (2 == ini_get('xdebug.overload_var_dump')) {
|
||||
$this->markTestSkipped('xdebug is active');
|
||||
}
|
||||
|
||||
$data = (array) json_decode('{"1":{}}');
|
||||
|
||||
$cloner = new VarCloner();
|
||||
$clone = $cloner->cloneVar($data);
|
||||
|
||||
$expected = <<<'EOTXT'
|
||||
object(Symfony\Component\VarDumper\Cloner\Data)#%i (6) {
|
||||
["data":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
array(2) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
array(1) {
|
||||
[1]=>
|
||||
int(1)
|
||||
}
|
||||
}
|
||||
[1]=>
|
||||
array(1) {
|
||||
["1"]=>
|
||||
object(Symfony\Component\VarDumper\Cloner\Stub)#%i (8) {
|
||||
["type"]=>
|
||||
int(4)
|
||||
["class"]=>
|
||||
string(8) "stdClass"
|
||||
["value"]=>
|
||||
NULL
|
||||
["cut"]=>
|
||||
int(0)
|
||||
["handle"]=>
|
||||
int(%i)
|
||||
["refCount"]=>
|
||||
int(0)
|
||||
["position"]=>
|
||||
int(0)
|
||||
["attr"]=>
|
||||
array(0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
["position":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
int(0)
|
||||
["key":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
int(0)
|
||||
["maxDepth":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
int(20)
|
||||
["maxItemsPerDepth":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
int(-1)
|
||||
["useRefHandles":"Symfony\Component\VarDumper\Cloner\Data":private]=>
|
||||
int(-1)
|
||||
}
|
||||
|
||||
EOTXT;
|
||||
ob_start();
|
||||
var_dump($clone);
|
||||
$this->assertStringMatchesFormat(\PHP_VERSION_ID >= 70200 ? str_replace('"1"', '1', $expected) : $expected, ob_get_clean());
|
||||
}
|
||||
|
||||
public function testCaster()
|
||||
{
|
||||
$cloner = new VarCloner(array(
|
||||
'*' => function ($obj, $array) {
|
||||
return array('foo' => 123);
|
||||
},
|
||||
__CLASS__ => function ($obj, $array) {
|
||||
++$array['foo'];
|
||||
|
||||
return $array;
|
||||
},
|
||||
));
|
||||
$clone = $cloner->cloneVar($this);
|
||||
|
||||
$expected = <<<EOTXT
|
||||
Symfony\Component\VarDumper\Cloner\Data Object
|
||||
(
|
||||
[data:Symfony\Component\VarDumper\Cloner\Data:private] => Array
|
||||
(
|
||||
[0] => Array
|
||||
(
|
||||
[0] => Symfony\Component\VarDumper\Cloner\Stub Object
|
||||
(
|
||||
[type] => 4
|
||||
[class] => %s
|
||||
[value] =>
|
||||
[cut] => 0
|
||||
[handle] => %i
|
||||
[refCount] => 0
|
||||
[position] => 1
|
||||
[attr] => Array
|
||||
(
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[1] => Array
|
||||
(
|
||||
[foo] => 124
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
[position:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[key:Symfony\Component\VarDumper\Cloner\Data:private] => 0
|
||||
[maxDepth:Symfony\Component\VarDumper\Cloner\Data:private] => 20
|
||||
[maxItemsPerDepth:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
[useRefHandles:Symfony\Component\VarDumper\Cloner\Data:private] => -1
|
||||
)
|
||||
|
||||
EOTXT;
|
||||
$this->assertStringMatchesFormat($expected, print_r($clone, true));
|
||||
}
|
||||
}
|
591
vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php
vendored
Normal file
591
vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php
vendored
Normal file
|
@ -0,0 +1,591 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
use Twig\Environment;
|
||||
use Twig\Loader\FilesystemLoader;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class CliDumperTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
require __DIR__.'/../Fixtures/dumb-var.php';
|
||||
|
||||
$dumper = new CliDumper('php://output');
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
$cloner->addCasters(array(
|
||||
':stream' => function ($res, $a) {
|
||||
unset($a['uri'], $a['wrapper_data']);
|
||||
|
||||
return $a;
|
||||
},
|
||||
));
|
||||
$data = $cloner->cloneVar($var);
|
||||
|
||||
ob_start();
|
||||
$dumper->dump($data);
|
||||
$out = ob_get_clean();
|
||||
$out = preg_replace('/[ \t]+$/m', '', $out);
|
||||
$intMax = PHP_INT_MAX;
|
||||
$res = (int) $var['res'];
|
||||
|
||||
$r = defined('HHVM_VERSION') ? '' : '#%d';
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
array:24 [
|
||||
"number" => 1
|
||||
0 => &1 null
|
||||
"const" => 1.1
|
||||
1 => true
|
||||
2 => false
|
||||
3 => NAN
|
||||
4 => INF
|
||||
5 => -INF
|
||||
6 => {$intMax}
|
||||
"str" => "déjà\\n"
|
||||
7 => b"é\\x00"
|
||||
"[]" => []
|
||||
"res" => stream resource {@{$res}
|
||||
%A wrapper_type: "plainfile"
|
||||
stream_type: "STDIO"
|
||||
mode: "r"
|
||||
unread_bytes: 0
|
||||
seekable: true
|
||||
%A options: []
|
||||
}
|
||||
"obj" => Symfony\Component\VarDumper\Tests\Fixture\DumbFoo {#%d
|
||||
+foo: "foo"
|
||||
+"bar": "bar"
|
||||
}
|
||||
"closure" => Closure {{$r}
|
||||
class: "Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest"
|
||||
this: Symfony\Component\VarDumper\Tests\Dumper\CliDumperTest {{$r} …}
|
||||
parameters: {
|
||||
\$a: {}
|
||||
&\$b: {
|
||||
typeHint: "PDO"
|
||||
default: null
|
||||
}
|
||||
}
|
||||
file: "%s%eTests%eFixtures%edumb-var.php"
|
||||
line: "{$var['line']} to {$var['line']}"
|
||||
}
|
||||
"line" => {$var['line']}
|
||||
"nobj" => array:1 [
|
||||
0 => &3 {#%d}
|
||||
]
|
||||
"recurs" => &4 array:1 [
|
||||
0 => &4 array:1 [&4]
|
||||
]
|
||||
8 => &1 null
|
||||
"sobj" => Symfony\Component\VarDumper\Tests\Fixture\DumbFoo {#%d}
|
||||
"snobj" => &3 {#%d}
|
||||
"snobj2" => {#%d}
|
||||
"file" => "{$var['file']}"
|
||||
b"bin-key-é" => ""
|
||||
]
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideDumpWithCommaFlagTests
|
||||
*/
|
||||
public function testDumpWithCommaFlag($expected, $flags)
|
||||
{
|
||||
$dumper = new CliDumper(null, null, $flags);
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$var = array(
|
||||
'array' => array('a', 'b'),
|
||||
'string' => 'hello',
|
||||
'multiline string' => "this\nis\na\multiline\nstring",
|
||||
);
|
||||
|
||||
$dump = $dumper->dump($cloner->cloneVar($var), true);
|
||||
|
||||
$this->assertSame($expected, $dump);
|
||||
}
|
||||
|
||||
public function testDumpWithCommaFlagsAndExceptionCodeExcerpt()
|
||||
{
|
||||
$dumper = new CliDumper(null, null, CliDumper::DUMP_TRAILING_COMMA);
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$ex = new \RuntimeException('foo');
|
||||
|
||||
$dump = $dumper->dump($cloner->cloneVar($ex)->withRefHandles(false), true);
|
||||
|
||||
$this->assertStringMatchesFormat(<<<'EOTXT'
|
||||
RuntimeException {
|
||||
#message: "foo"
|
||||
#code: 0
|
||||
#file: "%ACliDumperTest.php"
|
||||
#line: %d
|
||||
trace: {
|
||||
%ACliDumperTest.php:%d {
|
||||
›
|
||||
› $ex = new \RuntimeException('foo');
|
||||
›
|
||||
}
|
||||
%A
|
||||
}
|
||||
}
|
||||
|
||||
EOTXT
|
||||
, $dump);
|
||||
}
|
||||
|
||||
public function provideDumpWithCommaFlagTests()
|
||||
{
|
||||
$expected = <<<'EOTXT'
|
||||
array:3 [
|
||||
"array" => array:2 [
|
||||
0 => "a",
|
||||
1 => "b"
|
||||
],
|
||||
"string" => "hello",
|
||||
"multiline string" => """
|
||||
this\n
|
||||
is\n
|
||||
a\multiline\n
|
||||
string
|
||||
"""
|
||||
]
|
||||
|
||||
EOTXT;
|
||||
|
||||
yield array($expected, CliDumper::DUMP_COMMA_SEPARATOR);
|
||||
|
||||
$expected = <<<'EOTXT'
|
||||
array:3 [
|
||||
"array" => array:2 [
|
||||
0 => "a",
|
||||
1 => "b",
|
||||
],
|
||||
"string" => "hello",
|
||||
"multiline string" => """
|
||||
this\n
|
||||
is\n
|
||||
a\multiline\n
|
||||
string
|
||||
""",
|
||||
]
|
||||
|
||||
EOTXT;
|
||||
|
||||
yield array($expected, CliDumper::DUMP_TRAILING_COMMA);
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension xml
|
||||
*/
|
||||
public function testXmlResource()
|
||||
{
|
||||
$var = xml_parser_create();
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
xml resource {
|
||||
current_byte_index: %i
|
||||
current_column_number: %i
|
||||
current_line_number: 1
|
||||
error_code: XML_ERROR_NONE
|
||||
}
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
}
|
||||
|
||||
public function testJsonCast()
|
||||
{
|
||||
$var = (array) json_decode('{"0":{},"1":null}');
|
||||
foreach ($var as &$v) {
|
||||
}
|
||||
$var[] = &$v;
|
||||
$var[''] = 2;
|
||||
|
||||
if (\PHP_VERSION_ID >= 70200) {
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
array:4 [
|
||||
0 => {}
|
||||
1 => &1 null
|
||||
2 => &1 null
|
||||
"" => 2
|
||||
]
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
} else {
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
array:4 [
|
||||
"0" => {}
|
||||
"1" => &1 null
|
||||
0 => &1 null
|
||||
"" => 2
|
||||
]
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function testObjectCast()
|
||||
{
|
||||
$var = (object) array(1 => 1);
|
||||
$var->{1} = 2;
|
||||
|
||||
if (\PHP_VERSION_ID >= 70200) {
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
{
|
||||
+"1": 2
|
||||
}
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
} else {
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
{
|
||||
+1: 1
|
||||
+"1": 2
|
||||
}
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function testClosedResource()
|
||||
{
|
||||
if (defined('HHVM_VERSION') && HHVM_VERSION_ID < 30600) {
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
$var = fopen(__FILE__, 'r');
|
||||
fclose($var);
|
||||
|
||||
$dumper = new CliDumper('php://output');
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
$data = $cloner->cloneVar($var);
|
||||
|
||||
ob_start();
|
||||
$dumper->dump($data);
|
||||
$out = ob_get_clean();
|
||||
$res = (int) $var;
|
||||
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
Closed resource @{$res}
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
public function testFlags()
|
||||
{
|
||||
putenv('DUMP_LIGHT_ARRAY=1');
|
||||
putenv('DUMP_STRING_LENGTH=1');
|
||||
|
||||
$var = array(
|
||||
range(1, 3),
|
||||
array('foo', 2 => 'bar'),
|
||||
);
|
||||
|
||||
$this->assertDumpEquals(
|
||||
<<<EOTXT
|
||||
[
|
||||
[
|
||||
1
|
||||
2
|
||||
3
|
||||
]
|
||||
[
|
||||
0 => (3) "foo"
|
||||
2 => (3) "bar"
|
||||
]
|
||||
]
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
|
||||
putenv('DUMP_LIGHT_ARRAY=');
|
||||
putenv('DUMP_STRING_LENGTH=');
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires function Twig\Template::getSourceContext
|
||||
*/
|
||||
public function testThrowingCaster()
|
||||
{
|
||||
$out = fopen('php://memory', 'r+b');
|
||||
|
||||
require_once __DIR__.'/../Fixtures/Twig.php';
|
||||
$twig = new \__TwigTemplate_VarDumperFixture_u75a09(new Environment(new FilesystemLoader()));
|
||||
|
||||
$dumper = new CliDumper();
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
$cloner->addCasters(array(
|
||||
':stream' => function ($res, $a) {
|
||||
unset($a['wrapper_data']);
|
||||
|
||||
return $a;
|
||||
},
|
||||
));
|
||||
$cloner->addCasters(array(
|
||||
':stream' => eval('return function () use ($twig) {
|
||||
try {
|
||||
$twig->render(array());
|
||||
} catch (\Twig\Error\RuntimeError $e) {
|
||||
throw $e->getPrevious();
|
||||
}
|
||||
};'),
|
||||
));
|
||||
$ref = (int) $out;
|
||||
|
||||
$data = $cloner->cloneVar($out);
|
||||
$dumper->dump($data, $out);
|
||||
$out = stream_get_contents($out, -1, 0);
|
||||
|
||||
$r = defined('HHVM_VERSION') ? '' : '#%d';
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
stream resource {@{$ref}
|
||||
⚠: Symfony\Component\VarDumper\Exception\ThrowingCasterException {{$r}
|
||||
#message: "Unexpected Exception thrown from a caster: Foobar"
|
||||
trace: {
|
||||
%sTwig.php:2 {
|
||||
› foo bar
|
||||
› twig source
|
||||
›
|
||||
}
|
||||
%s%eTemplate.php:%d { …}
|
||||
%s%eTemplate.php:%d { …}
|
||||
%s%eTemplate.php:%d { …}
|
||||
%s%eTests%eDumper%eCliDumperTest.php:%d { …}
|
||||
%A }
|
||||
}
|
||||
%Awrapper_type: "PHP"
|
||||
stream_type: "MEMORY"
|
||||
mode: "%s+b"
|
||||
unread_bytes: 0
|
||||
seekable: true
|
||||
uri: "php://memory"
|
||||
%Aoptions: []
|
||||
}
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
public function testRefsInProperties()
|
||||
{
|
||||
$var = (object) array('foo' => 'foo');
|
||||
$var->bar = &$var->foo;
|
||||
|
||||
$dumper = new CliDumper();
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$data = $cloner->cloneVar($var);
|
||||
$out = $dumper->dump($data, true);
|
||||
|
||||
$r = defined('HHVM_VERSION') ? '' : '#%d';
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
{{$r}
|
||||
+"foo": &1 "foo"
|
||||
+"bar": &1 "foo"
|
||||
}
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
* @requires PHP 5.6
|
||||
*/
|
||||
public function testSpecialVars56()
|
||||
{
|
||||
$var = $this->getSpecialVars();
|
||||
|
||||
$this->assertDumpEquals(
|
||||
<<<'EOTXT'
|
||||
array:3 [
|
||||
0 => array:1 [
|
||||
0 => &1 array:1 [
|
||||
0 => &1 array:1 [&1]
|
||||
]
|
||||
]
|
||||
1 => array:1 [
|
||||
"GLOBALS" => &2 array:1 [
|
||||
"GLOBALS" => &2 array:1 [&2]
|
||||
]
|
||||
]
|
||||
2 => &2 array:1 [&2]
|
||||
]
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testGlobalsNoExt()
|
||||
{
|
||||
$var = $this->getSpecialVars();
|
||||
unset($var[0]);
|
||||
$out = '';
|
||||
|
||||
$dumper = new CliDumper(function ($line, $depth) use (&$out) {
|
||||
if ($depth >= 0) {
|
||||
$out .= str_repeat(' ', $depth).$line."\n";
|
||||
}
|
||||
});
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$refl = new \ReflectionProperty($cloner, 'useExt');
|
||||
$refl->setAccessible(true);
|
||||
$refl->setValue($cloner, false);
|
||||
|
||||
$data = $cloner->cloneVar($var);
|
||||
$dumper->dump($data);
|
||||
|
||||
$this->assertSame(
|
||||
<<<'EOTXT'
|
||||
array:2 [
|
||||
1 => array:1 [
|
||||
"GLOBALS" => &1 array:1 [
|
||||
"GLOBALS" => &1 array:1 [&1]
|
||||
]
|
||||
]
|
||||
2 => &1 array:1 [&1]
|
||||
]
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function testBuggyRefs()
|
||||
{
|
||||
if (\PHP_VERSION_ID >= 50600) {
|
||||
$this->markTestSkipped('PHP 5.6 fixed refs counting');
|
||||
}
|
||||
|
||||
$var = $this->getSpecialVars();
|
||||
$var = $var[0];
|
||||
|
||||
$dumper = new CliDumper();
|
||||
$dumper->setColors(false);
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$data = $cloner->cloneVar($var)->withMaxDepth(3);
|
||||
$out = '';
|
||||
$dumper->dump($data, function ($line, $depth) use (&$out) {
|
||||
if ($depth >= 0) {
|
||||
$out .= str_repeat(' ', $depth).$line."\n";
|
||||
}
|
||||
});
|
||||
|
||||
$this->assertSame(
|
||||
<<<'EOTXT'
|
||||
array:1 [
|
||||
0 => array:1 [
|
||||
0 => array:1 [
|
||||
0 => array:1 [ …1]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
public function testIncompleteClass()
|
||||
{
|
||||
$unserializeCallbackHandler = ini_set('unserialize_callback_func', null);
|
||||
$var = unserialize('O:8:"Foo\Buzz":0:{}');
|
||||
ini_set('unserialize_callback_func', $unserializeCallbackHandler);
|
||||
|
||||
$this->assertDumpMatchesFormat(
|
||||
<<<EOTXT
|
||||
__PHP_Incomplete_Class(Foo\Buzz) {}
|
||||
EOTXT
|
||||
,
|
||||
$var
|
||||
);
|
||||
}
|
||||
|
||||
private function getSpecialVars()
|
||||
{
|
||||
foreach (array_keys($GLOBALS) as $var) {
|
||||
if ('GLOBALS' !== $var) {
|
||||
unset($GLOBALS[$var]);
|
||||
}
|
||||
}
|
||||
|
||||
$var = function &() {
|
||||
$var = array();
|
||||
$var[] = &$var;
|
||||
|
||||
return $var;
|
||||
};
|
||||
|
||||
return array($var(), $GLOBALS, &$GLOBALS);
|
||||
}
|
||||
}
|
164
vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php
vendored
Normal file
164
vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php
vendored
Normal file
|
@ -0,0 +1,164 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Dumper;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class HtmlDumperTest extends TestCase
|
||||
{
|
||||
public function testGet()
|
||||
{
|
||||
require __DIR__.'/../Fixtures/dumb-var.php';
|
||||
|
||||
$dumper = new HtmlDumper('php://output');
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$cloner = new VarCloner();
|
||||
$cloner->addCasters(array(
|
||||
':stream' => function ($res, $a) {
|
||||
unset($a['uri'], $a['wrapper_data']);
|
||||
|
||||
return $a;
|
||||
},
|
||||
));
|
||||
$data = $cloner->cloneVar($var);
|
||||
|
||||
ob_start();
|
||||
$dumper->dump($data);
|
||||
$out = ob_get_clean();
|
||||
$out = preg_replace('/[ \t]+$/m', '', $out);
|
||||
$var['file'] = htmlspecialchars($var['file'], ENT_QUOTES, 'UTF-8');
|
||||
$intMax = PHP_INT_MAX;
|
||||
preg_match('/sf-dump-\d+/', $out, $dumpId);
|
||||
$dumpId = $dumpId[0];
|
||||
$res = (int) $var['res'];
|
||||
|
||||
$r = defined('HHVM_VERSION') ? '' : '<a class=sf-dump-ref>#%d</a>';
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<EOTXT
|
||||
<foo></foo><bar><span class=sf-dump-note>array:24</span> [<samp>
|
||||
"<span class=sf-dump-key>number</span>" => <span class=sf-dump-num>1</span>
|
||||
<span class=sf-dump-key>0</span> => <a class=sf-dump-ref href=#{$dumpId}-ref01 title="2 occurrences">&1</a> <span class=sf-dump-const>null</span>
|
||||
"<span class=sf-dump-key>const</span>" => <span class=sf-dump-num>1.1</span>
|
||||
<span class=sf-dump-key>1</span> => <span class=sf-dump-const>true</span>
|
||||
<span class=sf-dump-key>2</span> => <span class=sf-dump-const>false</span>
|
||||
<span class=sf-dump-key>3</span> => <span class=sf-dump-num>NAN</span>
|
||||
<span class=sf-dump-key>4</span> => <span class=sf-dump-num>INF</span>
|
||||
<span class=sf-dump-key>5</span> => <span class=sf-dump-num>-INF</span>
|
||||
<span class=sf-dump-key>6</span> => <span class=sf-dump-num>{$intMax}</span>
|
||||
"<span class=sf-dump-key>str</span>" => "<span class=sf-dump-str title="5 characters">d&%s;j&%s;<span class=sf-dump-default>\\n</span></span>"
|
||||
<span class=sf-dump-key>7</span> => b"<span class=sf-dump-str title="2 binary or non-UTF-8 characters">&%s;<span class=sf-dump-default>\\x00</span></span>"
|
||||
"<span class=sf-dump-key>[]</span>" => []
|
||||
"<span class=sf-dump-key>res</span>" => <span class=sf-dump-note>stream resource</span> <a class=sf-dump-ref>@{$res}</a><samp>
|
||||
%A <span class=sf-dump-meta>wrapper_type</span>: "<span class=sf-dump-str title="9 characters">plainfile</span>"
|
||||
<span class=sf-dump-meta>stream_type</span>: "<span class=sf-dump-str title="5 characters">STDIO</span>"
|
||||
<span class=sf-dump-meta>mode</span>: "<span class=sf-dump-str>r</span>"
|
||||
<span class=sf-dump-meta>unread_bytes</span>: <span class=sf-dump-num>0</span>
|
||||
<span class=sf-dump-meta>seekable</span>: <span class=sf-dump-const>true</span>
|
||||
%A <span class=sf-dump-meta>options</span>: []
|
||||
</samp>}
|
||||
"<span class=sf-dump-key>obj</span>" => <abbr title="Symfony\Component\VarDumper\Tests\Fixture\DumbFoo" class=sf-dump-note>DumbFoo</abbr> {<a class=sf-dump-ref href=#{$dumpId}-ref2%d title="2 occurrences">#%d</a><samp id={$dumpId}-ref2%d>
|
||||
+<span class=sf-dump-public title="Public property">foo</span>: "<span class=sf-dump-str title="3 characters">foo</span>"
|
||||
+"<span class=sf-dump-public title="Runtime added dynamic property">bar</span>": "<span class=sf-dump-str title="3 characters">bar</span>"
|
||||
</samp>}
|
||||
"<span class=sf-dump-key>closure</span>" => <span class=sf-dump-note>Closure</span> {{$r}<samp>
|
||||
<span class=sf-dump-meta>class</span>: "<span class=sf-dump-str title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest
|
||||
55 characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-class">Symfony\Component\VarDumper\Tests\Dumper</span><span class=sf-dump-ellipsis>\</span>HtmlDumperTest</span>"
|
||||
<span class=sf-dump-meta>this</span>: <abbr title="Symfony\Component\VarDumper\Tests\Dumper\HtmlDumperTest" class=sf-dump-note>HtmlDumperTest</abbr> {{$r} &%s;}
|
||||
<span class=sf-dump-meta>parameters</span>: {<samp>
|
||||
<span class=sf-dump-meta>\$a</span>: {}
|
||||
<span class=sf-dump-meta>&\$b</span>: {<samp>
|
||||
<span class=sf-dump-meta>typeHint</span>: "<span class=sf-dump-str title="3 characters">PDO</span>"
|
||||
<span class=sf-dump-meta>default</span>: <span class=sf-dump-const>null</span>
|
||||
</samp>}
|
||||
</samp>}
|
||||
<span class=sf-dump-meta>file</span>: "<span class=sf-dump-str title="{$var['file']}
|
||||
%d characters"><span class="sf-dump-ellipsis sf-dump-ellipsis-path">%s%eVarDumper</span><span class=sf-dump-ellipsis>%e</span>Tests%eFixtures%edumb-var.php</span>"
|
||||
<span class=sf-dump-meta>line</span>: "<span class=sf-dump-str title="%d characters">{$var['line']} to {$var['line']}</span>"
|
||||
</samp>}
|
||||
"<span class=sf-dump-key>line</span>" => <span class=sf-dump-num>{$var['line']}</span>
|
||||
"<span class=sf-dump-key>nobj</span>" => <span class=sf-dump-note>array:1</span> [<samp>
|
||||
<span class=sf-dump-index>0</span> => <a class=sf-dump-ref href=#{$dumpId}-ref03 title="2 occurrences">&3</a> {<a class=sf-dump-ref href=#{$dumpId}-ref2%d title="3 occurrences">#%d</a>}
|
||||
</samp>]
|
||||
"<span class=sf-dump-key>recurs</span>" => <a class=sf-dump-ref href=#{$dumpId}-ref04 title="2 occurrences">&4</a> <span class=sf-dump-note>array:1</span> [<samp id={$dumpId}-ref04>
|
||||
<span class=sf-dump-index>0</span> => <a class=sf-dump-ref href=#{$dumpId}-ref04 title="2 occurrences">&4</a> <span class=sf-dump-note>array:1</span> [<a class=sf-dump-ref href=#{$dumpId}-ref04 title="2 occurrences">&4</a>]
|
||||
</samp>]
|
||||
<span class=sf-dump-key>8</span> => <a class=sf-dump-ref href=#{$dumpId}-ref01 title="2 occurrences">&1</a> <span class=sf-dump-const>null</span>
|
||||
"<span class=sf-dump-key>sobj</span>" => <abbr title="Symfony\Component\VarDumper\Tests\Fixture\DumbFoo" class=sf-dump-note>DumbFoo</abbr> {<a class=sf-dump-ref href=#{$dumpId}-ref2%d title="2 occurrences">#%d</a>}
|
||||
"<span class=sf-dump-key>snobj</span>" => <a class=sf-dump-ref href=#{$dumpId}-ref03 title="2 occurrences">&3</a> {<a class=sf-dump-ref href=#{$dumpId}-ref2%d title="3 occurrences">#%d</a>}
|
||||
"<span class=sf-dump-key>snobj2</span>" => {<a class=sf-dump-ref href=#{$dumpId}-ref2%d title="3 occurrences">#%d</a>}
|
||||
"<span class=sf-dump-key>file</span>" => "<span class=sf-dump-str title="%d characters">{$var['file']}</span>"
|
||||
b"<span class=sf-dump-key>bin-key-&%s;</span>" => ""
|
||||
</samp>]
|
||||
</bar>
|
||||
|
||||
EOTXT
|
||||
,
|
||||
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
public function testCharset()
|
||||
{
|
||||
$var = mb_convert_encoding('Словарь', 'CP1251', 'UTF-8');
|
||||
|
||||
$dumper = new HtmlDumper('php://output', 'CP1251');
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$data = $cloner->cloneVar($var);
|
||||
$out = $dumper->dump($data, true);
|
||||
|
||||
$this->assertStringMatchesFormat(
|
||||
<<<'EOTXT'
|
||||
<foo></foo><bar>b"<span class=sf-dump-str title="7 binary or non-UTF-8 characters">Словарь</span>"
|
||||
</bar>
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
|
||||
public function testAppend()
|
||||
{
|
||||
$out = fopen('php://memory', 'r+b');
|
||||
|
||||
$dumper = new HtmlDumper();
|
||||
$dumper->setDumpHeader('<foo></foo>');
|
||||
$dumper->setDumpBoundaries('<bar>', '</bar>');
|
||||
$cloner = new VarCloner();
|
||||
|
||||
$dumper->dump($cloner->cloneVar(123), $out);
|
||||
$dumper->dump($cloner->cloneVar(456), $out);
|
||||
|
||||
$out = stream_get_contents($out, -1, 0);
|
||||
|
||||
$this->assertSame(<<<'EOTXT'
|
||||
<foo></foo><bar><span class=sf-dump-num>123</span>
|
||||
</bar>
|
||||
<bar><span class=sf-dump-num>456</span>
|
||||
</bar>
|
||||
|
||||
EOTXT
|
||||
,
|
||||
$out
|
||||
);
|
||||
}
|
||||
}
|
11
vendor/symfony/var-dumper/Tests/Fixtures/FooInterface.php
vendored
Normal file
11
vendor/symfony/var-dumper/Tests/Fixtures/FooInterface.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Fixtures;
|
||||
|
||||
interface FooInterface
|
||||
{
|
||||
/**
|
||||
* Hello.
|
||||
*/
|
||||
public function foo();
|
||||
}
|
21
vendor/symfony/var-dumper/Tests/Fixtures/GeneratorDemo.php
vendored
Normal file
21
vendor/symfony/var-dumper/Tests/Fixtures/GeneratorDemo.php
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Fixtures;
|
||||
|
||||
class GeneratorDemo
|
||||
{
|
||||
public static function foo()
|
||||
{
|
||||
yield 1;
|
||||
}
|
||||
|
||||
public function baz()
|
||||
{
|
||||
yield from bar();
|
||||
}
|
||||
}
|
||||
|
||||
function bar()
|
||||
{
|
||||
yield from GeneratorDemo::foo();
|
||||
}
|
7
vendor/symfony/var-dumper/Tests/Fixtures/NotLoadableClass.php
vendored
Normal file
7
vendor/symfony/var-dumper/Tests/Fixtures/NotLoadableClass.php
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Fixtures;
|
||||
|
||||
class NotLoadableClass extends NotLoadableClass
|
||||
{
|
||||
}
|
38
vendor/symfony/var-dumper/Tests/Fixtures/Twig.php
vendored
Normal file
38
vendor/symfony/var-dumper/Tests/Fixtures/Twig.php
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/* foo.twig */
|
||||
class __TwigTemplate_VarDumperFixture_u75a09 extends Twig\Template
|
||||
{
|
||||
private $path;
|
||||
|
||||
public function __construct(Twig\Environment $env = null, $path = null)
|
||||
{
|
||||
if (null !== $env) {
|
||||
parent::__construct($env);
|
||||
}
|
||||
$this->parent = false;
|
||||
$this->blocks = array();
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
protected function doDisplay(array $context, array $blocks = array())
|
||||
{
|
||||
// line 2
|
||||
throw new \Exception('Foobar');
|
||||
}
|
||||
|
||||
public function getTemplateName()
|
||||
{
|
||||
return 'foo.twig';
|
||||
}
|
||||
|
||||
public function getDebugInfo()
|
||||
{
|
||||
return array(20 => 1, 21 => 2);
|
||||
}
|
||||
|
||||
public function getSourceContext()
|
||||
{
|
||||
return new Twig\Source(" foo bar\n twig source\n\n", 'foo.twig', $this->path ?: __FILE__);
|
||||
}
|
||||
}
|
40
vendor/symfony/var-dumper/Tests/Fixtures/dumb-var.php
vendored
Normal file
40
vendor/symfony/var-dumper/Tests/Fixtures/dumb-var.php
vendored
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Fixture;
|
||||
|
||||
if (!class_exists('Symfony\Component\VarDumper\Tests\Fixture\DumbFoo')) {
|
||||
class DumbFoo
|
||||
{
|
||||
public $foo = 'foo';
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new DumbFoo();
|
||||
$foo->bar = 'bar';
|
||||
|
||||
$g = fopen(__FILE__, 'r');
|
||||
|
||||
$var = array(
|
||||
'number' => 1, null,
|
||||
'const' => 1.1, true, false, NAN, INF, -INF, PHP_INT_MAX,
|
||||
'str' => "déjà\n", "\xE9\x00",
|
||||
'[]' => array(),
|
||||
'res' => $g,
|
||||
'obj' => $foo,
|
||||
'closure' => function ($a, \PDO &$b = null) {},
|
||||
'line' => __LINE__ - 1,
|
||||
'nobj' => array((object) array()),
|
||||
);
|
||||
|
||||
$r = array();
|
||||
$r[] = &$r;
|
||||
|
||||
$var['recurs'] = &$r;
|
||||
$var[] = &$var[0];
|
||||
$var['sobj'] = $var['obj'];
|
||||
$var['snobj'] = &$var['nobj'][0];
|
||||
$var['snobj2'] = $var['nobj'][0];
|
||||
$var['file'] = __FILE__;
|
||||
$var["bin-key-\xE9"] = '';
|
||||
|
||||
unset($g, $r);
|
10
vendor/symfony/var-dumper/Tests/Fixtures/xml_reader.xml
vendored
Normal file
10
vendor/symfony/var-dumper/Tests/Fixtures/xml_reader.xml
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<foo>
|
||||
<bar></bar>
|
||||
<bar />
|
||||
<bar>With text</bar>
|
||||
<bar foo="bar" baz="fubar"></bar>
|
||||
<bar xmlns:baz="http://symfony.com">
|
||||
<baz:baz></baz:baz>
|
||||
</bar>
|
||||
</foo>
|
41
vendor/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php
vendored
Normal file
41
vendor/symfony/var-dumper/Tests/Test/VarDumperTestTraitTest.php
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper\Tests\Test;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\VarDumper\Test\VarDumperTestTrait;
|
||||
|
||||
class VarDumperTestTraitTest extends TestCase
|
||||
{
|
||||
use VarDumperTestTrait;
|
||||
|
||||
public function testItComparesLargeData()
|
||||
{
|
||||
$howMany = 700;
|
||||
$data = array_fill_keys(range(0, $howMany), array('a', 'b', 'c', 'd'));
|
||||
|
||||
$expected = sprintf("array:%d [\n", $howMany + 1);
|
||||
for ($i = 0; $i <= $howMany; ++$i) {
|
||||
$expected .= <<<EODUMP
|
||||
$i => array:4 [
|
||||
0 => "a"
|
||||
1 => "b"
|
||||
2 => "c"
|
||||
3 => "d"
|
||||
]\n
|
||||
EODUMP;
|
||||
}
|
||||
$expected .= "]\n";
|
||||
|
||||
$this->assertDumpEquals($expected, $data);
|
||||
}
|
||||
}
|
48
vendor/symfony/var-dumper/VarDumper.php
vendored
Normal file
48
vendor/symfony/var-dumper/VarDumper.php
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\VarDumper;
|
||||
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
|
||||
|
||||
// Load the global dump() function
|
||||
require_once __DIR__.'/Resources/functions/dump.php';
|
||||
|
||||
/**
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
class VarDumper
|
||||
{
|
||||
private static $handler;
|
||||
|
||||
public static function dump($var)
|
||||
{
|
||||
if (null === self::$handler) {
|
||||
$cloner = new VarCloner();
|
||||
$dumper = in_array(PHP_SAPI, array('cli', 'phpdbg')) ? new CliDumper() : new HtmlDumper();
|
||||
self::$handler = function ($var) use ($cloner, $dumper) {
|
||||
$dumper->dump($cloner->cloneVar($var));
|
||||
};
|
||||
}
|
||||
|
||||
return call_user_func(self::$handler, $var);
|
||||
}
|
||||
|
||||
public static function setHandler(callable $callable = null)
|
||||
{
|
||||
$prevHandler = self::$handler;
|
||||
self::$handler = $callable;
|
||||
|
||||
return $prevHandler;
|
||||
}
|
||||
}
|
47
vendor/symfony/var-dumper/composer.json
vendored
Normal file
47
vendor/symfony/var-dumper/composer.json
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
{
|
||||
"name": "symfony/var-dumper",
|
||||
"type": "library",
|
||||
"description": "Symfony mechanism for exploring and dumping PHP variables",
|
||||
"keywords": ["dump", "debug"],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"ext-iconv": "*",
|
||||
"twig/twig": "~1.34|~2.4"
|
||||
},
|
||||
"conflict": {
|
||||
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
|
||||
"ext-intl": "To show region name in time zone dump",
|
||||
"ext-symfony_debug": ""
|
||||
},
|
||||
"autoload": {
|
||||
"files": [ "Resources/functions/dump.php" ],
|
||||
"psr-4": { "Symfony\\Component\\VarDumper\\": "" },
|
||||
"exclude-from-classmap": [
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
}
|
||||
}
|
33
vendor/symfony/var-dumper/phpunit.xml.dist
vendored
Normal file
33
vendor/symfony/var-dumper/phpunit.xml.dist
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
failOnRisky="true"
|
||||
failOnWarning="true"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
<env name="DUMP_LIGHT_ARRAY" value="" />
|
||||
<env name="DUMP_STRING_LENGTH" value="" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Symfony VarDumper Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>./</directory>
|
||||
<exclude>
|
||||
<directory>./Resources</directory>
|
||||
<directory>./Tests</directory>
|
||||
<directory>./vendor</directory>
|
||||
</exclude>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
Loading…
Add table
Add a link
Reference in a new issue