class CutStub
Represents the main properties of a PHP variable, pre-casted by a caster.
@author Nicolas Grekas <p@tchwork.com>
Hierarchy
- class \Symfony\Component\VarDumper\Cloner\Stub
- class \Symfony\Component\VarDumper\Caster\CutStub extends \Symfony\Component\VarDumper\Cloner\Stub
Expanded class hierarchy of CutStub
1 file declares its use of CutStub
- DataCollector.php in vendor/
symfony/ http-kernel/ DataCollector/ DataCollector.php
File
-
vendor/
symfony/ var-dumper/ Caster/ CutStub.php, line 21
Namespace
Symfony\Component\VarDumper\CasterView source
class CutStub extends Stub {
public function __construct(mixed $value) {
$this->value = $value;
switch (\gettype($value)) {
case 'object':
$this->type = self::TYPE_OBJECT;
$this->class = $value::class;
if ($value instanceof \Closure) {
ReflectionCaster::castClosure($value, [], $this, true, Caster::EXCLUDE_VERBOSE);
}
$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;
}
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
CutStub::__construct | public | function | 1 | |
Stub::$attr | public | property | ||
Stub::$class | public | property | ||
Stub::$cut | public | property | ||
Stub::$defaultProperties | private static | property | ||
Stub::$handle | public | property | ||
Stub::$position | public | property | ||
Stub::$refCount | public | property | ||
Stub::$type | public | property | ||
Stub::$value | public | property | ||
Stub::ARRAY_ASSOC | public | constant | ||
Stub::ARRAY_INDEXED | public | constant | ||
Stub::STRING_BINARY | public | constant | ||
Stub::STRING_UTF8 | public | constant | ||
Stub::TYPE_ARRAY | public | constant | ||
Stub::TYPE_OBJECT | public | constant | ||
Stub::TYPE_REF | public | constant | ||
Stub::TYPE_RESOURCE | public | constant | ||
Stub::TYPE_SCALAR | public | constant | ||
Stub::TYPE_STRING | public | constant | ||
Stub::__sleep | public | function | @internal |