public getConstants ( boolean $namesOnly = true ) : array | Zend\Code\Scanner\ConstantScanner[] | ||
$namesOnly | boolean | Set false to return instances of ConstantScanner |
return | array | Zend\Code\Scanner\ConstantScanner[] |
public function getConstants($namesOnly = true)
{
if (true === $namesOnly) {
trigger_error('Use method getConstantNames() instead', E_USER_DEPRECATED);
return $this->getConstantNames();
}
$this->scan();
$return = [];
foreach ($this->infos as $info) {
if ($info['type'] != 'constant') {
continue;
}
$return[] = $this->getConstant($info['name']);
}
return $return;
}
/** * @return array */ public function getConstants() { $constants = $this->classScanner->getConstants(); foreach ($this->parentClassScanners as $pClassScanner) { $constants = array_merge($constants, $pClassScanner->getConstants()); } return $constants; }