Nette\PhpGenerator\Method::getParameters PHP Method

getParameters() public method

public getParameters ( ) : Parameter[]
return Parameter[]
    public function getParameters()
    {
        return $this->parameters;
    }

Usage Example

Example #1
0
 /**
  * @param \ReflectionMethod $from
  * @param Code\Method $method
  * @throws \ReflectionException
  * @return Code\Method
  */
 public static function expandTypeHints(\ReflectionMethod $from, Code\Method $method)
 {
     $parameters = $method->getParameters();
     /** @var Code\Parameter[] $parameters */
     foreach ($from->getParameters() as $paramRefl) {
         try {
             $parameters[$paramRefl->getName()]->setTypeHint($paramRefl->isArray() ? 'array' : ($paramRefl->getClass() ? '\\' . $paramRefl->getClass()->getName() : ''));
         } catch (\ReflectionException $e) {
             if (preg_match('#Class (.+) does not exist#', $e->getMessage(), $m)) {
                 $parameters[$paramRefl->getName()]->setTypeHint('\\' . $m[1]);
             } else {
                 throw $e;
             }
         }
     }
     $method->setParameters($parameters);
     if (!$method->getVisibility()) {
         $method->setVisibility('public');
     }
     return $method;
 }