class PhpParser

internal  
 

Parses PHP source code and returns:

  • the start/end line information about functions, classes, interfaces, traits and their methods
  • the count of code lines
  • the count of commented code lines

Methods

parse(string $code)

Returned structure is: stdClass { linesOfCode: int, linesOfComments: int, functions: [functionName => $functionInfo], classes: [className => $info], traits: [traitName => $info], interfaces: [interfaceName => $info], }

Details

at line 54
stdClass parse(string $code)

Returned structure is: stdClass { linesOfCode: int, linesOfComments: int, functions: [functionName => $functionInfo], classes: [className => $info], traits: [traitName => $info], interfaces: [interfaceName => $info], }

where $functionInfo is: stdClass { start: int, end: int }

and $info is: stdClass { start: int, end: int, methods: [methodName => $methodInfo] }

where $methodInfo is: stdClass { start: int, end: int, visibility: public|protected|private }

Parameters

string $code

Return Value

stdClass