getConstant() 공개 메소드

Return a single constant by given name or index of info
public getConstant ( string | integer $constantNameOrInfoIndex ) : boolean | Zend\Code\Scanner\ConstantScanner
$constantNameOrInfoIndex string | integer
리턴 boolean | Zend\Code\Scanner\ConstantScanner
예제 #1
0
 /**
  * Return a single constant by given name or index of info
  *
  * @param  string|int $constantNameOrInfoIndex
  * @throws Exception\InvalidArgumentException
  * @return bool|ConstantScanner
  */
 public function getConstant($constantNameOrInfoIndex)
 {
     if ($this->classScanner->hasConstant($constantNameOrInfoIndex)) {
         return $this->classScanner->getConstant($constantNameOrInfoIndex);
     }
     foreach ($this->parentClassScanners as $pClassScanner) {
         if ($pClassScanner->hasConstant($constantNameOrInfoIndex)) {
             return $pClassScanner->getConstant($constantNameOrInfoIndex);
         }
     }
     throw new Exception\InvalidArgumentException(sprintf('Constant %s not found in %s', $constantNameOrInfoIndex, $this->classScanner->getName()));
 }