/** * Builds a method object based on the provided method scanner * * @param MethodScanner $classMethod * @return Method */ protected function buildMethod(MethodScanner $classMethod) { $method = new Method($classMethod->getName()); $method->setNumberOfParameters($classMethod->getNumberOfParameters()); // Loop through annotations if ($annotations = $classMethod->getAnnotations($this->annotationManager)) { foreach ($annotations as $annotation) { // @todo annotations should implement some kind of interface? if (method_exists($annotation, 'decorateObject')) { $annotation->decorateObject($method); } } } return $method; }
protected function processParams(&$def, DerivedClassScanner $sClass, MethodScanner $sMethod) { if (count($sMethod->getParameters()) === 0) { return; } $methodName = $sMethod->getName(); $def['parameters'][$methodName] = array(); foreach ($sMethod->getParameters(true) as $position => $p) { /** @var $p \Zend\Code\Scanner\ParameterScanner */ $actualParamName = $p->getName(); $paramName = $this->createDistinctParameterName($actualParamName, $sClass->getName()); $fqName = $sClass->getName() . '::' . $sMethod->getName() . ':' . $position; $def['parameters'][$methodName][$fqName] = array(); // set the class name, if it exists $def['parameters'][$methodName][$fqName][] = $actualParamName; $def['parameters'][$methodName][$fqName][] = ($p->getClass() !== null) ? $p->getClass() : null; $def['parameters'][$methodName][$fqName][] = !$p->isOptional(); } }