public function getConstant($constantNameOrInfoIndex)
{
$this->scan();
if (is_int($constantNameOrInfoIndex)) {
$info = $this->infos[$constantNameOrInfoIndex];
if ($info['type'] != 'constant') {
throw new Exception\InvalidArgumentException('Index of info offset is not about a constant');
}
} elseif (is_string($constantNameOrInfoIndex)) {
$constantFound = false;
foreach ($this->infos as $info) {
if ($info['type'] === 'constant' && $info['name'] === $constantNameOrInfoIndex) {
$constantFound = true;
break;
}
}
if (!$constantFound) {
return false;
}
} else {
throw new Exception\InvalidArgumentException('Invalid constant name of info index type. Must be of type int or string');
}
if (!isset($info)) {
return false;
}
$p = new ConstantScanner(array_slice($this->tokens, $info['tokenStart'], $info['tokenEnd'] - $info['tokenStart'] + 1), $this->nameInformation);
$p->setClass($this->name);
$p->setScannerClass($this);
return $p;
}