method analyzeClass documentation in bbn\Parsers\Php
Function that analyzes the desired class by returning the information belonging to it
function(string $cls, string $path = '', $level = 'public')
{
$rc = new \ReflectionClass($cls);
if (!empty($cls) && is_object($rc)) {
$constructor = $rc->getConstructor();
if ($level) {
}
$methods = $rc->getMethods(\ReflectionMethod::IS_PUBLIC);
$props = $rc->getProperties(\ReflectionMethod::IS_PUBLIC);
$statprops = $rc->getStaticProperties();
$constants = $rc->getConstants();
$parent = $rc->getParentClass();
$res = [
'doc' => $this->parseClassComments($rc->getDocComment()),
'name' => $rc->getName(),
'namespace' => $rc->getNamespaceName(),
'traits' => $rc->getTraitNames(),
'interfaces' => $rc->getInterfaces(),
//'isInstantiable' => $rc->isInstantiable(),
//'cloneable' => $rc->isCloneable(),
'fileName' => substr($rc->getFileName(), strlen($path)),
'startLine' => $rc->getStartLine(),
'endLine' => $rc->getEndLine(),
'numMethods' => $methods ? count($methods) : 0,
'numProperties' => $props ? count($props) : 0,
'numConstants' => $constants ? count($constants) : 0,
'numStaticProperties' => $statprops ? count($statprops) : 0,
'interfaces' => $rc->getInterfaces(),
'interfaceNames' => $rc->getInterfaceNames(),
'isInterface' => $rc->isInterface(),
'traitNames' => $rc->getTraitNames(),
'traitAliases' => $rc->getTraitAliases(),
'isTrait' => $rc->isTrait(),
'isAbstract' => $rc->isAbstract(),
'isFinal' => $rc->isFinal(),
'modifiers' => $rc->getModifiers(),
'parentClass' => $parent ? $parent->name : null,
'isSubclassOf' => $rc->isSubclassOf($cls),
'defaultProperties' => $rc->getDefaultProperties(),
'isIterable' => $rc->isIterable(),
//'implementsInterface' => $rc->implementsInterface(),
'extensionName' => $rc->getExtensionName(),
'namespace' => $rc->inNamespace(),
'namespaceName' => $rc->getNamespaceName(),
'shortName' => $rc->getShortName(),
'contentConstructor' => !empty($constructor) ? array_filter(
$this->analyzeMethod($constructor->name, $rc),
function ($m, $i) {
return in_array($i, ['file', 'returns']);
},
ARRAY_FILTER_USE_BOTH
) : null,
'methods' => $methods ? $this->orderElement($methods, 'methods', $rc) : null,
'properties' => $props ? $this->orderElement($props, 'properties', $rc) : null,
'staticProperties' => $statprops,
'constants' => $constants ? $this->orderElement($constants, 'costants', $rc) : null
];
if (
$res['doc']
&& ($extracted = $this->_extract_description($res['doc']['description']))
) {
$res = X::mergeArrays($res, $extracted);
}
return $res;
}
}
Function that analyzes the desired class by returning the information belonging to it 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