src/Analyse/Routing/Process/ProcessClosure.php
public function process(Model $model)
    {
        $ref = new \ReflectionFunction($model->getData());

        $result = array();

        // Adding comments from the file.
        $result[static::META_COMMENT] =  $this->pool
            ->createClass('Brainworxx\\Krexx\\Analyse\\Comment\\Functions')
            ->getComment($ref);

        // Adding the sourcecode
        $highlight = $ref->getStartLine() -1;
        $result[static::META_SOURCE] = $this->pool->fileService->readSourcecode(
            $ref->getFileName(),
            $highlight,
            $highlight - 3,
            $ref->getEndLine() -1
        );

        // Adding the place where it was declared.
        $result[static::META_DECLARED_IN] = $this->pool->fileService->filterFilePath($ref->getFileName()) . "\n";
        $result[static::META_DECLARED_IN] .= 'in line ' . $ref->getStartLine();

        // Adding the namespace, but only if we have one.
        $namespace = $ref->getNamespaceName();
        if (empty($namespace) === false) {
            $result[static::META_NAMESPACE] = $namespace;
        }

        // Adding the parameters.
        $paramList = '';

        foreach ($ref->getParameters() as $key => $reflectionParameter) {
            ++$key;
            $paramList .=  $result[static::META_PARAM_NO . $key] = $this->pool
                ->codegenHandler
                ->parameterToString($reflectionParameter);
            // We add a comma to the parameter list, to separate them for a
            // better readability.
            $paramList .= ', ';
        }

        return $this->pool->render->renderExpandableChild(
            $model->setType(static::TYPE_CLOSURE)
                ->setNormal(static::UNKNOWN_VALUE)
                // Remove the ',' after the last char.
                ->setConnectorParameters(trim($paramList, ', '))
                ->setDomid($this->generateDomIdFromObject($model->getData()))
                ->setConnectorType(Connectors::METHOD)
                ->addParameter(static::PARAM_DATA, $result)
                ->injectCallback(
                    $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughMethodAnalysis')
                )
        );
    }
public function process(Model $model)
    {
        $ref = new \ReflectionFunction($model->getData());

        $result = array();

        // Adding comments from the file.
        $result[static::META_COMMENT] =  $this->pool
            ->createClass('Brainworxx\\Krexx\\Analyse\\Comment\\Functions')
            ->getComment($ref);

        // Adding the sourcecode
        $highlight = $ref->getStartLine() -1;
        $result[static::META_SOURCE] = $this->pool->fileService->readSourcecode(
            $ref->getFileName(),
            $highlight,
            $highlight - 3,
            $ref->getEndLine() -1
        );

        // Adding the place where it was declared.
        $result[static::META_DECLARED_IN] = $this->pool->fileService->filterFilePath($ref->getFileName()) . "\n";
        $result[static::META_DECLARED_IN] .= 'in line ' . $ref->getStartLine();

        // Adding the namespace, but only if we have one.
        $namespace = $ref->getNamespaceName();
        if (empty($namespace) === false) {
            $result[static::META_NAMESPACE] = $namespace;
        }

        // Adding the parameters.
        $paramList = '';

        foreach ($ref->getParameters() as $key => $reflectionParameter) {
            ++$key;
            $paramList .=  $result[static::META_PARAM_NO . $key] = $this->pool
                ->codegenHandler
                ->parameterToString($reflectionParameter);
            // We add a comma to the parameter list, to separate them for a
            // better readability.
            $paramList .= ', ';
        }

        return $this->pool->render->renderExpandableChild(
            $model->setType(static::TYPE_CLOSURE)
                ->setNormal(static::UNKNOWN_VALUE)
                // Remove the ',' after the last char.
                ->setConnectorParameters(trim($paramList, ', '))
                ->setDomid($this->generateDomIdFromObject($model->getData()))
                ->setConnectorType(Connectors::METHOD)
                ->addParameter(static::PARAM_DATA, $result)
                ->injectCallback(
                    $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughMethodAnalysis')
                )
        );
    }
public function process ( Model $ model ) { $ ref = new \ ReflectionFunction ( $ model -> getData ( ) ) ; $ result = array ( ) ; // Adding comments from the file. $ result [ static :: META_COMMENT ] = $ this -> pool -> createClass ( 'Brainworxx\\Krexx\\Analyse\\Comment\\Functions' ) -> getComment ( $ ref ) ; // Adding the sourcecode $ highlight = $ ref -> getStartLine ( ) - 1 ; $ result [ static :: META_SOURCE ] = $ this -> pool -> fileService -> readSourcecode ( $ ref -> getFileName ( ) , $ highlight , $ highlight - 3 , $ ref -> getEndLine ( ) - 1 ) ; // Adding the place where it was declared. $ result [ static :: META_DECLARED_IN ] = $ this -> pool -> fileService -> filterFilePath ( $ ref -> getFileName ( ) ) . "\n" ; $ result [ static :: META_DECLARED_IN ] .= 'in line ' . $ ref -> getStartLine ( ) ; // Adding the namespace, but only if we have one. $ namespace = $ ref -> getNamespaceName ( ) ; if ( empty ( $ namespace ) === false ) { $ result [ static :: META_NAMESPACE ] = $ namespace ; } // Adding the parameters. $ paramList = '' ; foreach ( $ ref -> getParameters ( ) as $ key => $ reflectionParameter ) { ++ $ key ; $ paramList .= $ result [ static :: META_PARAM_NO . $ key ] = $ this -> pool -> codegenHandler -> parameterToString ( $ reflectionParameter ) ; // We add a comma to the parameter list, to separate them for a // better readability. $ paramList .= ', ' ; } return $ this -> pool -> render -> renderExpandableChild ( $ model -> setType ( static :: TYPE_CLOSURE ) -> setNormal ( static :: UNKNOWN_VALUE ) // Remove the ',' after the last char. -> setConnectorParameters ( trim ( $ paramList , ', ' ) ) -> setDomid ( $ this -> generateDomIdFromObject ( $ model -> getData ( ) ) ) -> setConnectorType ( Connectors :: METHOD ) -> addParameter ( static :: PARAM_DATA , $ result ) -> injectCallback ( $ this -> pool -> createClass ( 'Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughMethodAnalysis' ) ) ) ; }
Analyses a closure.

@param Model $model
The closure we want to analyse.

@throws \ReflectionException

@return string
The generated markup.
Analyses a closure .