method analyzeConstant documentation in bbn\Parsers\Php
Function that analyzes the constant passed to him and even if it contains the relative parent of the class of belonging
function(string $const, ReflectionClass $cls)
{
if (
!empty($const)
&& !empty($cls)
&& $cls->hasConstant($const)
) {
$cst = $cls->getReflectionConstant($const);
$arr = [
'name' => $cst->name,
'value' => $cls->getConstant($const),
'class' => $cls->name,
'parent' => false,
'private' => $cst->isPrivate(),
'protected' => $cst->isProtected(),
'public' => $cst->isPublic(),
'doc' => $this->parsePropertyComments($cst->getDocComment()),
];
$parent = $cls->getParentClass();
while ($parent) {
if ($parent->hasConstant($const)) {
$cst = $cls->getReflectionConstant($const);
$arr['parent'] = [
'name' => $cst->name,
'doc' => $this->parsePropertyComments($cst->getDocComment()),
'value' => $parent->getConstant($const),
'protected' => $cst->isProtected(),
'public' => $cst->isPublic(),
'class' => $parent->name,
'parent' => false
];
}
$parent = $parent->getParentClass();
}
}
if (isset($arr)) {
return $arr;
}
return null;
}
Function that analyzes the constant passed to him and even if it contains the relative parent of the class of belonging BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions