public function getCodeFromDocumentation(string $fileContent): array
    {
        $start = strpos($fileContent, Constants::MARKDOWN_PHP_CODE_KEYWORD);
        $code = substr($fileContent, $start);

        $regularExpression = '!' . Constants::MARKDOWN_PHP_CODE_KEYWORD . self::DOCUMENTATION_REGEX . '!';
        if (!preg_match_all($regularExpression, $code, $matches)) {
            return [];
        }

        return array_map(
            function ($line) {
                return trim($line);
            },
            $matches[1]
        );
    }
public function getCodeFromDocumentation(string $fileContent): array
    {
        $start = strpos($fileContent, Constants::MARKDOWN_PHP_CODE_KEYWORD);
        $code = substr($fileContent, $start);

        $regularExpression = '!' . Constants::MARKDOWN_PHP_CODE_KEYWORD . self::DOCUMENTATION_REGEX . '!';
        if (!preg_match_all($regularExpression, $code, $matches)) {
            return [];
        }

        return array_map(
            function ($line) {
                return trim($line);
            },
            $matches[1]
        );
    }
public function getCodeFromDocumentation ( string $ fileContent ) : array { $ start = strpos ( $ fileContent , Constants :: MARKDOWN_PHP_CODE_KEYWORD ) ; $ code = substr ( $ fileContent , $ start ) ; $ regularExpression = '!' . Constants :: MARKDOWN_PHP_CODE_KEYWORD . self :: DOCUMENTATION_REGEX . '!' ; if ( ! preg_match_all ( $ regularExpression , $ code , $ matches ) ) { return [ ] ; } return array_map ( function ( $ line ) { return trim ( $ line ) ; } , $ matches [ 1 ] ) ; }
Extract the example code from the documentation file

@param string $fileContent
@return string[]
Extract the example code from the documentation file