/** * @param string $helperName * @param MethodReflection $methodReflection * @return string */ protected function getMethodDescription($helperName, $methodReflection) { $methodDescription = ''; $methodName = $methodReflection->getName(); $methodParameters = array(); foreach ($methodReflection->getParameters() as $parameterReflection) { $methodParameters[$parameterReflection->getName()] = $parameterReflection; } $parameterNames = array_keys($methodParameters); $methodSignature = str_replace('_', '\\_', $helperName . '.' . $methodName . '(' . implode(', ', $parameterNames) . ')'); $methodDescription .= $methodSignature . chr(10) . str_repeat('^', strlen($methodSignature)) . chr(10) . chr(10); if ($methodReflection->getDescription() !== '') { $methodDescription .= $methodReflection->getDescription() . chr(10) . chr(10); } if ($methodReflection->isTaggedWith('param')) { $paramTagValues = $methodReflection->getTagValues('param'); foreach ($paramTagValues as $paramTagValue) { $values = explode(' ', $paramTagValue, 3); list($parameterType, $parameterName) = $values; $parameterName = ltrim($parameterName, '$'); $parameterDescription = isset($values[2]) ? $values[2] : ''; $parameterOptionalSuffix = $methodParameters[$parameterName]->isOptional() ? ', *optional*' : ''; $methodDescription .= trim('* ``' . $parameterName . '`` (' . $parameterType . $parameterOptionalSuffix . ') ' . $parameterDescription) . chr(10); } $methodDescription .= chr(10); } if ($methodReflection->isTaggedWith('return')) { list($returnTagValue) = $methodReflection->getTagValues('return'); $values = explode(' ', $returnTagValue, 2); list($returnType) = $values; $returnDescription = isset($values[1]) ? $values[1] : ''; $methodDescription .= '**Return** (' . $returnType . ') ' . $returnDescription . chr(10); } return $methodDescription; }
/** * @param string $className * @param \TYPO3\Flow\Reflection\MethodReflection $method * @return void */ protected function reflectClassMethod($className, MethodReflection $method) { $methodName = $method->getName(); if ($method->isFinal()) { $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_FINAL] = true; } if ($method->isStatic()) { $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_STATIC] = true; } $visibility = $method->isPublic() ? self::VISIBILITY_PUBLIC : ($method->isProtected() ? self::VISIBILITY_PROTECTED : self::VISIBILITY_PRIVATE); $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_VISIBILITY] = $visibility; foreach ($this->getMethodAnnotations($className, $methodName) as $methodAnnotation) { $this->classesByMethodAnnotations[get_class($methodAnnotation)][$className] = $methodName; } $returnType = $method->getDeclaredReturnType(); if ($returnType !== null) { $this->classReflectionData[$className][self::DATA_CLASS_METHODS][$methodName][self::DATA_METHOD_DECLARED_RETURN_TYPE] = $returnType; } foreach ($method->getParameters() as $parameter) { $this->reflectClassMethodParameter($className, $method, $parameter); } }