Parser

in package

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.

Properties

private$defaultPackageName  : string                

private$validate  : bool                

private$markers  : string[]                

private$ignoredTags  : string[]                

private$path  : string                

private$logger  : \Psr\Log\LoggerInterface                

private$encoding  : string                

private$stopwatch  : \Symfony\Component\Stopwatch\Stopwatch                

private$projectFactory  : \phpDocumentor\Reflection\ProjectFactory                

Methods

Initializes the parser.

public__construct(ProjectFactory $projectFactory, Stopwatch $stopwatch, LoggerInterface $logger) : mixed

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

$projectFactory : ProjectFactory
$stopwatch : Stopwatch
$logger : LoggerInterface

Returns

mixed
codeCoverageIgnore

the ini_get call cannot be tested as setting it using ini_set has no effect.

Sets whether to run PHPLint on every file.

publicsetValidate(bool $validate) : void

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

Parameters

$validate : bool

when true this file will be checked.

Returns whether we want to run PHPLint on every file.

publicdoValidation() : bool

Returns

bool

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

publicsetMarkers(string[] $markers) : void

Parameters

$markers : string[]

A list or markers to gather.

Returns the list of markers.

publicgetMarkers() : string[]

Returns

string[]

Sets a list of tags to ignore.

publicsetIgnoredTags(string[] $ignoredTags) : void

Parameters

$ignoredTags : string[]

A list of tags to ignore.

Returns the list of ignored tags.

publicgetIgnoredTags() : string[]

Returns

string[]

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

publicsetPath(string $path) : void

Parameters

$path : string

Must be an absolute path.

Returns the absolute base path for all files.

publicgetPath() : string

Returns

string

Sets the name of the default package.

publicsetDefaultPackageName(string $defaultPackageName) : void

Parameters

$defaultPackageName : string

Name used to categorize elements without an @package tag.

Returns the name of the default package.

publicgetDefaultPackageName() : string

Returns

string

Sets the encoding of the files.

publicsetEncoding(string $encoding) : void

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

$encoding : string

Returns the currently active encoding.

publicgetEncoding() : string

Returns

string

Iterates through the given files feeds them to the builder.

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

Parameters

$files : \phpDocumentor\Reflection\File[]

Returns

Project

Writes the complete parsing cycle to log.

privatelogAfterParsingAllFiles() : void

Dispatches a logging request.

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

Parameters

$message : string

The message to log.

$priority : string = LogLevel::INFO

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

$parameters : string[] = []

privatestartTimingTheParsePhase() : void