getMethod() public method

Return a single method by given name or index of info
public getMethod ( string | integer $methodNameOrInfoIndex ) : Zend\Code\Scanner\MethodScanner
$methodNameOrInfoIndex string | integer
return Zend\Code\Scanner\MethodScanner
 /**
  * @param  int|string $methodNameOrInfoIndex
  * @return MethodScanner
  * @throws Exception\InvalidArgumentException
  */
 public function getMethod($methodNameOrInfoIndex)
 {
     if ($this->classScanner->hasMethod($methodNameOrInfoIndex)) {
         return $this->classScanner->getMethod($methodNameOrInfoIndex);
     }
     foreach ($this->parentClassScanners as $pClassScanner) {
         if ($pClassScanner->hasMethod($methodNameOrInfoIndex)) {
             return $pClassScanner->getMethod($methodNameOrInfoIndex);
         }
     }
     throw new Exception\InvalidArgumentException(sprintf('Method %s not found in %s', $methodNameOrInfoIndex, $this->classScanner->getName()));
 }
Example #2
0
 public function compileScannerInstantiator(ClassScanner $scannerClass)
 {
     if ($scannerClass->hasMethod('__construct')) {
         $construct = $scannerClass->getMethod('__construct');
         if ($construct->isPublic()) {
             return '__construct';
         }
     }
     
     return null;
     
     // @todo scan parent classes for instantiator
 }