Jarves\Configuration\Model::getMethodMetaData PHP Method

getMethodMetaData() public method

public getMethodMetaData ( ReflectionMethod | ReflectionClass $reflection ) : array | boolean
$reflection ReflectionMethod | ReflectionClass
return array | boolean
    public function getMethodMetaData($reflection)
    {
        $file = $reflection->getFileName();
        $startLine = $reflection->getStartLine();
        $fh = fopen($file, 'r');
        if (!$fh) {
            return false;
        }
        $lineNr = 1;
        $lines = array();
        while (($buffer = fgets($fh)) !== false) {
            if ($lineNr == $startLine) {
                break;
            }
            $lines[$lineNr] = $buffer;
            $lineNr++;
        }
        fclose($fh);
        $phpDoc = '';
        $blockStarted = false;
        while ($line = array_pop($lines)) {
            if ($blockStarted) {
                $phpDoc = $line . $phpDoc;
                //if start comment block: /*
                if (preg_match('/\\s*\\t*\\/\\*/', $line)) {
                    break;
                }
                continue;
            } else {
                //we are not in a comment block.
                //if class def, array def or close bracked from fn comes above
                //then we dont have phpdoc
                if (preg_match('/^\\s*\\t*[a-zA-Z_&\\s]*(\\$|{|})/', $line)) {
                    break;
                }
            }
            $trimmed = trim($line);
            if ($trimmed == '') {
                continue;
            }
            //if end comment block: */
            if (preg_match('/\\*\\//', $line)) {
                $phpDoc = $line . $phpDoc;
                $blockStarted = true;
                //one line php doc?
                if (preg_match('/\\s*\\t*\\/\\*/', $line)) {
                    break;
                }
            }
        }
        return $this->parsePhpDoc($phpDoc);
    }