Ejemplo n.º 1
0
 /**
  * Creates a method code from Reflection
  *
  * @param ParsedMethod $method Reflection for method
  * @param string $body Body of method
  *
  * @return string
  */
 protected function getOverriddenMethod(ParsedMethod $method, $body)
 {
     $code = preg_replace('/ {4}|\\t/', '', $method->getDocComment()) . "\n" . join(' ', Reflection::getModifierNames($method->getModifiers())) . ' function ' . ($method->returnsReference() ? '&' : '') . $method->name . '(' . join(', ', $this->getParameters($method->getParameters())) . ")\n" . "{\n" . $this->indent($body) . "\n" . "}\n";
     return $code;
 }
Ejemplo n.º 2
0
 /**
  * Gets the annotations applied to a method.
  *
  * @param ParsedReflectionMethod $method The ReflectionMethod of the method from which
  *                                   the annotations should be read.
  * @return array An array of Annotations.
  */
 public function getMethodAnnotations(ParsedReflectionMethod $method)
 {
     $this->parser->setTarget(Target::TARGET_METHOD);
     return $this->parser->parse($method->getDocComment(), 'method ' . $method->getDeclaringClass()->name . '::' . $method->getName() . '()');
 }