Files container handling directory scanning, project root detection and ignores.

category phpDocumentor
package Parser
author Mike van Riel
license MIT
link http://phpdoc.org

 Methods

Adds a file extension to the list of allowed extensions.

addAllowedExtension(string $extension) : void

No dot is necessary and will even prevent the extension from being picked up.

Parameters

$extension

string

Allowed file Extension to add (i.e. php).

Adds the content of a set of directories to the list of files to parse.

addDirectories(array $paths) : void

Parameters

$paths

array

The paths whose contents to add to the collection.

Retrieve all files in the given directory and add them to the parsing list.

addDirectory(string $path) : void

Parameters

$path

string

A path to a folder, may be relative, absolute or even phar.

Exceptions

\InvalidArgumentException if the given path is not a folder.

Adds a file to the collection.

addFile(string $path) : void

Parameters

$path

string

File location, may be absolute, relative or even phar.

Adds a list of individual files to the collection.

addFiles(array $paths) : void

Parameters

$paths

array

File locations, may be absolute, relative or even phar.

Adds an ignore pattern to the collection.

addIgnorePattern(string $pattern) : void

Parameters

$pattern

string

Glob-like pattern to filter files with.

Dispatches a logging request to log a debug message.

debug(string $message) : void
Inherited

inherited_from \phpDocumentor_Parser_Abstract::debug()

Parameters

$message

string

The message to log.

Dispatches an event to the Event Dispatcher.

dispatch(string $name, \string[] $arguments) : mixed | null
Inherited

This method tries to dispatch an event; if no Event Dispatcher has been set than this method will explicitly not fail and return null. By not failing we make the Event Dispatcher optional and is it easier for people to re-use this component in their own application.

inherited_from \phpDocumentor_Parser_Abstract::dispatch()

Parameters

$name

string

Name of the event to dispatch.

$arguments

\string[]

Arguments for this event.

Exceptions

\phpDocumentor_Parser_Exception if there is a dispatcher but it is not of type sfEventDispatcher

Returns

mixednull

Returns a list of files that are ready to be parsed.

getFiles() : \string[]

Please note that the ignore pattern will be applied and all files are converted to absolute paths.

Returns

\string[]

Returns whether files and folders that are hidden are ignored.

getIgnoreHidden() : boolean

Returns

boolean

Returns the ignore patterns.

getIgnorePatterns() : array

Returns

array

Calculates the project root from the given files by determining their highest common path.

getProjectRoot() : string

Returns

string

Dispatches a logging request.

log(string $message, int $priority) : void
Inherited

inherited_from \phpDocumentor_Parser_Abstract::log()

Parameters

$message

string

The message to log.

$priority

int

The logging priority, the lower, the more important. Ranges from 1 to 7

Sets a list of allowed extensions; if not used php, php3 and phtml is assumed.

setAllowedExtensions(array $extensions) : void

Parameters

$extensions

array

An array containing extensions to match for.

Sets whether to ignore hidden files and folders.

setIgnoreHidden(boolean $ignore_hidden) : void

Parameters

$ignore_hidden

boolean

if true skips hidden files and folders.

Sets the patterns by which to detect which files to ignore.

setIgnorePatterns(array $patterns) : void

Parameters

$patterns

array

Glob-like patterns to filter files.

Converts $string into a string that can be used with preg_match.

convertToPregCompliant(string $string) : void

author Greg Beaver
author mike van Riel
see \PhpDocumentor/phpDocumentor/Io.php

Parameters

$string

string

&$string Glob-like pattern with wildcards ? and *.

Returns the filename, relative to the root of the project directory.

getRelativeFilename(string $filename) : string

Parameters

$filename

string

The filename to make relative.

Exceptions

\InvalidArgumentException if file is not in the project root.

Returns

string

 Properties

 

The event dispatcher object, may be null to not dispatch events.

$event_dispatcher : \sfEventDispatcher | null
Inherited

inherited_from \phpDocumentor_Parser_Abstract::$$event_dispatcher
 

<p>Array containing a list of allowed line endings; defaults to php, php3 and phtml.</p>

$allowed_extensions : \string[]

 

<p>An array containing the file names which must be processed</p>

$files : \string[]

   

<p>Whether to ignore hidden files and folders</p>

$ignore_hidden : bool

 

the glob patterns which directories/files to ignore during parsing and how many files were ignored.

$ignore_patterns : \array[]

Structure of this array is: array( 0 => 1 => )

 

<p>Detected root folder for this project</p>

$project_root : string