\phpDocumentor\ParserParser

Class responsible for parsing the given file or files to the intermediate structure file.

This class can be used to parse one or more files to the intermediate file format for further processing.

Summary

Methods
Properties
Constants
__construct()
setValidate()
doValidation()
setMarkers()
getMarkers()
setPath()
getPath()
setDefaultPackageName()
getDefaultPackageName()
setEncoding()
getEncoding()
parse()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
logAfterParsingAllFiles()
log()
startTimingTheParsePhase()
$defaultPackageName
$validate
$markers
$path
$logger
$encoding
$stopwatch
$projectFactory
N/A

Properties

$defaultPackageName

$defaultPackageName : string

Type

string — the name of the default package

$validate

$validate : bool

Type

bool — whether to execute a PHPLint on every file

$markers

$markers : string[]

Type

string[] — which markers (i.e. TODO or FIXME) to collect

$path

$path : string

Type

string — target location's root path

$logger

$logger : \Psr\Log\LoggerInterface

Type

\Psr\Log\LoggerInterface —

$encoding

$encoding : string

Type

string — The encoding in which the files are encoded

$stopwatch

$stopwatch : \Symfony\Component\Stopwatch\Stopwatch

Type

\Symfony\Component\Stopwatch\Stopwatch — The profiling component that measures time and memory usage over time

$projectFactory

$projectFactory : \phpDocumentor\Reflection\ProjectFactory

Type

\phpDocumentor\Reflection\ProjectFactory —

Methods

__construct()

__construct(\phpDocumentor\Reflection\ProjectFactory  $projectFactory, \Symfony\Component\Stopwatch\Stopwatch  $stopwatch, \Psr\Log\LoggerInterface  $logger) : mixed

Initializes the parser.

This constructor checks the user's PHP ini settings to detect which encoding is used by default. This encoding is used as a default value for phpDocumentor to convert the source files that it receives.

If no encoding is specified than 'utf-8' is assumed by default.

Parameters

\phpDocumentor\Reflection\ProjectFactory $projectFactory
\Symfony\Component\Stopwatch\Stopwatch $stopwatch
\Psr\Log\LoggerInterface $logger

Returns

mixed —

setValidate()

setValidate(bool  $validate) : void

Sets whether to run PHPLint on every file.

PHPLint has a huge performance impact on the execution of phpDocumentor and is thus disabled by default.

Parameters

bool $validate

when true this file will be checked.

doValidation()

doValidation() : bool

Returns whether we want to run PHPLint on every file.

Returns

bool —

setMarkers()

setMarkers(string[]  $markers) : void

Sets a list of markers to gather (i.e. TODO, FIXME).

Parameters

string[] $markers

A list or markers to gather.

getMarkers()

getMarkers() : string[]

Returns the list of markers.

Returns

string[] —

setPath()

setPath(string  $path) : void

Sets the base path of the files that will be parsed.

Parameters

string $path

Must be an absolute path.

getPath()

getPath() : string

Returns the absolute base path for all files.

Returns

string —

setDefaultPackageName()

setDefaultPackageName(string  $defaultPackageName) : void

Sets the name of the default package.

Parameters

string $defaultPackageName

Name used to categorize elements without an @package tag.

getDefaultPackageName()

getDefaultPackageName() : string

Returns the name of the default package.

Returns

string —

setEncoding()

setEncoding(string  $encoding) : void

Sets the encoding of the files.

With this option it is possible to tell the parser to use a specific encoding to interpret the provided files. By default this is set to UTF-8, in which case no action is taken. Any other encoding will result in the output being converted to UTF-8 using iconv.

Please note that it is recommended to provide files in UTF-8 format; this will ensure a faster performance since no transformation is required.

Parameters

string $encoding

getEncoding()

getEncoding() : string

Returns the currently active encoding.

Returns

string —

parse()

parse(\phpDocumentor\Reflection\File[]  $files) : \phpDocumentor\Reflection\Php\Project

Iterates through the given files feeds them to the builder.

Parameters

\phpDocumentor\Reflection\File[] $files

Returns

\phpDocumentor\Reflection\Php\Project —

logAfterParsingAllFiles()

logAfterParsingAllFiles() : void

Writes the complete parsing cycle to log.

log()

log(string  $message, string  $priority = LogLevel::INFO, string[]  $parameters = []) : void

Dispatches a logging request.

Parameters

string $message

The message to log.

string $priority

The logging priority as declared in the LogLevel PSR-3 class.

string[] $parameters

startTimingTheParsePhase()

startTimingTheParsePhase() : void