class Kint_Objects_Closure
Hierarchy
- class \KintObject
- class \Kint_Objects_Closure extends \KintObject
Expanded class hierarchy of Kint_Objects_Closure
File
-
kint/
kint/ parsers/ objects/ closure.php, line 3
View source
class Kint_Objects_Closure extends KintObject {
public function parse(&$variable) {
if (!$variable instanceof Closure) {
return false;
}
$this->name = 'Closure';
$reflection = new ReflectionFunction($variable);
$ret = array(
'Parameters' => array(),
);
if ($val = $reflection->getParameters()) {
foreach ($val as $parameter) {
// todo http://php.net/manual/en/class.reflectionparameter.php
$ret['Parameters'][] = $parameter->name;
}
}
if ($val = $reflection->getStaticVariables()) {
$ret['Uses'] = $val;
}
if (method_exists($reflection, 'getClousureThis') && ($val = $reflection->getClosureThis())) {
$ret['Uses']['$this'] = $val;
}
if ($val = $reflection->getFileName()) {
$this->value = Kint::shortenPath($val) . ':' . $reflection->getStartLine();
}
return $ret;
}
public function isDefaultValueAvailable() {
if (PHP_VERSION_ID === 50316) {
// PHP bug #62988
try {
$this->getDefaultValue();
return true;
} catch (\ReflectionException $e) {
return false;
}
}
return parent::isDefaultValueAvailable();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
KintObject::$name | public | property | @var string type of variable, can be set in inherited object or in static::parse() method | |
KintObject::$value | public | property | @var string quick variable value displayed inline | |
Kint_Objects_Closure::isDefaultValueAvailable | public | function | ||
Kint_Objects_Closure::parse | public | function | * returns false or associative array - each key represents a tab in default view, values may be anything * * |
Overrides KintObject::parse |