protected function getMethodCode($method)
    {
        $reflection = new \ReflectionMethod($this->model, $method);

        $file = new \SplFileObject($reflection->getFileName());
        $file->seek($reflection->getStartLine() - 1);

        $methodCode = '';

        while ($file->key() < $reflection->getEndLine()) {
            $methodCode .= $file->current();

            $file->next();
        }

        $methodCode = trim(preg_replace('/\s\s+/', '', $methodCode));

        $start = strpos($methodCode, 'function(');
        $length = strrpos($methodCode, '}') - $start + 1;

        return substr($methodCode, $start, $length);
    }
protected function getMethodCode($method)
    {
        $reflection = new \ReflectionMethod($this->model, $method);

        $file = new \SplFileObject($reflection->getFileName());
        $file->seek($reflection->getStartLine() - 1);

        $methodCode = '';

        while ($file->key() < $reflection->getEndLine()) {
            $methodCode .= $file->current();

            $file->next();
        }

        $methodCode = trim(preg_replace('/\s\s+/', '', $methodCode));

        $start = strpos($methodCode, 'function(');
        $length = strrpos($methodCode, '}') - $start + 1;

        return substr($methodCode, $start, $length);
    }
protected function getMethodCode ( $ method ) { $ reflection = new \ ReflectionMethod ( $ this -> model , $ method ) ; $ file = new \ SplFileObject ( $ reflection -> getFileName ( ) ) ; $ file -> seek ( $ reflection -> getStartLine ( ) - 1 ) ; $ methodCode = '' ; while ( $ file -> key ( ) < $ reflection -> getEndLine ( ) ) { $ methodCode .= $ file -> current ( ) ; $ file -> next ( ) ; } $ methodCode = trim ( preg_replace ( '/\s\s+/' , '' , $ methodCode ) ) ; $ start = strpos ( $ methodCode , 'function(' ) ; $ length = strrpos ( $ methodCode , '}' ) - $ start + 1 ; return substr ( $ methodCode , $ start , $ length ) ; }
Get the source code of a method of the model.

@param  string $method
@return string
Get the source code of a method of the model .