public static function fromReflection(ReflectionFunction $reflectionFunction)
    {
        $name = self::extractShortNameFromFullyQualifiedName($reflectionFunction->getName());
        $namespace = self::extractNamespaceFromQualifiedName($reflectionFunction->getName());

        $function = new static($name, trim($reflectionFunction->getBody()));
        $function->setNamespace($namespace);
        foreach ($reflectionFunction->getParameters() as $parameter) {
            $function->addParameter(ParameterGenerator::fromReflection($parameter));
        }

        if ($reflectionFunction->getReflectionDocComment()->isEmpty() !== true) {
            $function->setDocumentation(
                DocCommentGenerator::fromReflection($reflectionFunction->getReflectionDocComment())
            );
        }

        return $function;
    }
public static function fromReflection(ReflectionFunction $reflectionFunction)
    {
        $name = self::extractShortNameFromFullyQualifiedName($reflectionFunction->getName());
        $namespace = self::extractNamespaceFromQualifiedName($reflectionFunction->getName());

        $function = new static($name, trim($reflectionFunction->getBody()));
        $function->setNamespace($namespace);
        foreach ($reflectionFunction->getParameters() as $parameter) {
            $function->addParameter(ParameterGenerator::fromReflection($parameter));
        }

        if ($reflectionFunction->getReflectionDocComment()->isEmpty() !== true) {
            $function->setDocumentation(
                DocCommentGenerator::fromReflection($reflectionFunction->getReflectionDocComment())
            );
        }

        return $function;
    }
public static function fromReflection ( ReflectionFunction $ reflectionFunction ) { $ name = self :: extractShortNameFromFullyQualifiedName ( $ reflectionFunction -> getName ( ) ) ; $ namespace = self :: extractNamespaceFromQualifiedName ( $ reflectionFunction -> getName ( ) ) ; $ function = new static ( $ name , trim ( $ reflectionFunction -> getBody ( ) ) ) ; $ function -> setNamespace ( $ namespace ) ; foreach ( $ reflectionFunction -> getParameters ( ) as $ parameter ) { $ function -> addParameter ( ParameterGenerator :: fromReflection ( $ parameter ) ) ; } if ( $ reflectionFunction -> getReflectionDocComment ( ) -> isEmpty ( ) !== true ) { $ function -> setDocumentation ( DocCommentGenerator :: fromReflection ( $ reflectionFunction -> getReflectionDocComment ( ) ) ) ; } return $ function ; }
Create a new function from reflection.

@param \Wingu\OctopusCore\Reflection\ReflectionFunction $reflectionFunction The reflection of the function.
@return \Wingu\OctopusCore\CodeGenerator\PHP\FunctionGenerator
Create a new function from reflection .