Provides the basic functionality for every static reflection class.

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

 Methods

Default behavior of the toString method is to return the name of this reflection.

__toString() : string

Returns

string

Dispatches a logging request to log a debug message.

debug(string $message) : void

Parameters

$message

string

The message to log.

Dispatches an event to the Event Dispatcher.

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

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.

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 the token id which identifies the end of the object.

getEndTokenId() : int

Returns

int

Returns the name of the file to which this element is related.

getFilename() : string

Returns

string

Returns the line number where this token starts.

getLineNumber() : int

Returns

int

Returns the name for this Reflection object.

getName() : string

Returns

string

Returns the name of the namespace to which this belongs.

getNamespace() : string

Returns

string

Returns the namespace aliases which can be applied to the types in this object.

getNamespaceAliases() : \string[]

Returns

\string[]

Getter; returns the token id which identifies the start of this object.

getStartTokenId() : int

Returns

int

Dispatches a logging request.

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

Parameters

$message

string

The message to log.

$priority

int

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

Main function which reads the token iterator and parses the current token.

parseTokenizer(phpDocumentor_Reflection_TokenIterator $tokens) : void

Parameters

$tokens

\phpDocumentor_Reflection_TokenIterator

The iterator with tokens.

Sets the file name for this file.

setFilename(string $filename) : void

Parameters

$filename

string

The path of this file.

Sets the name for this Reflection Object.

setName(string $name) : void

Parameters

$name

string

String with unlimited length.

Exceptions

\InvalidArgumentException

Sets the name of the namespace to which this belongs.

setNamespace(string $namespace) : void

Parameters

$namespace

string

Full name of namespace.

Exceptions

\InvalidArgumentException

Sets the list of namespace aliases in the parent file..

setNamespaceAliases(\string[] $namespace_aliases) : void

Parameters

$namespace_aliases

\string[]

List of aliases to apply.

Exceptions

\InvalidArgumentException

Determine whether this token has the abstract keyword.

findAbstract(phpDocumentor_Reflection_TokenIterator $tokens) : \phpDocumentor_Reflection_Token | null

Please note that the iterator cursor does not change due to this method

Parameters

$tokens

\phpDocumentor_Reflection_TokenIterator

The iterator with tokens.

Returns

Find the Default value for this object.

findDefault(phpDocumentor_Reflection_TokenIterator $tokens) : string | null

Usually used with variables or arguments. Please note that the iterator cursor does not change due to this method

Parameters

$tokens

\phpDocumentor_Reflection_TokenIterator

The iterator with tokens.

Returns

stringnull

Determine whether this token has the final keyword.

findFinal(phpDocumentor_Reflection_TokenIterator $tokens) : \phpDocumentor_Reflection_Token | null

Please note that the iterator cursor does not change due to this method

Parameters

$tokens

\phpDocumentor_Reflection_TokenIterator

The iterator with tokens.

Returns

Determine whether this token has the static keyword.

findStatic(phpDocumentor_Reflection_TokenIterator $tokens) : \phpDocumentor_Reflection_Token | null

Please note that the iterator cursor does not change due to this method

Parameters

$tokens

\phpDocumentor_Reflection_TokenIterator

The iterator with tokens.

Returns

Find the Type for this object.

findType(phpDocumentor_Reflection_TokenIterator $tokens) : string | null

Please note that the iterator cursor does not change due to this method

Parameters

$tokens

\phpDocumentor_Reflection_TokenIterator

The iterator with tokens.

Returns

stringnull

Searches for visibility specifiers with the current token.

findVisibility(phpDocumentor_Reflection_TokenIterator $tokens) : string

Parameters

$tokens

\phpDocumentor_Reflection_TokenIterator

Token iterator to search in.

Returns

stringpublic|private|protected

Helper method which merges a $document into $origin.

mergeDomDocuments(DOMDocument $origin, DOMDocument $document) : void

Parameters

$origin

\DOMDocument

The document to accept the changes.

$document

\DOMDocument

The changes which are to be merged into the origin.

Helper used to merge a given XML string into a given DOMDocument.

mergeXmlToDomDocument(DOMDocument $origin, string $xml) : void

Parameters

$origin

\DOMDocument

Destination to merge the XML into.

$xml

string

The XML to merge with the document.

Processes the meta-data of the 'main' token.

processGenericInformation(phpDocumentor_Reflection_TokenIterator $tokens) : void

Example: for the phpDocumentor_Reflection_Function class this would be the name, parameters, etc.

Parameters

$tokens

\phpDocumentor_Reflection_TokenIterator

The iterator with tokens.

Processes the current token and invokes the correct process* method.

processToken(phpDocumentor_Reflection_Token $token, phpDocumentor_Reflection_TokenIterator $tokens) : void

Tokens are automatically parsed by invoking a process* method (i.e. processFunction for a T_FUNCTION). If a method, which conforms to the standard above, does not exist the token is ignored.

Parameters

$token

\phpDocumentor_Reflection_Token

The specific token which needs processing.

$tokens

\phpDocumentor_Reflection_TokenIterator

The iterator with tokens.

Scans all tokens within the scope of the current token and invokes the process* methods.

processTokens(phpDocumentor_Reflection_TokenIterator $tokens) : \int[]

This is a base class which may be overridden in sub-classes to scan the scope of the current token (i.e. the method body in case of the method)

Parameters

$tokens

\phpDocumentor_Reflection_TokenIterator

iterator with the current position

Returns

\int[]Start and End token id

 Properties

 

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

$event_dispatcher : \sfEventDispatcher | null

 

<p>The path of the file.</p>

$filename : string

 

Stores the line where the initial token was found.

$line_start : int

 

Stores the name for this Reflection object.

$name : string

 

Stores the name of the namespace to which this belongs.

$namespace : string

 

Stores the aliases and full names of any defined namespace alias (T_USE).

$namespace_aliases : \string[]

 

Stores the end position by token index.

$token_end : int

 

Stores the start position by token index.

$token_start : int

 

Stores the method name of the processing method for a token.

$_token_method_cache : \string[]

The generation of method names may be a performance costly task and is quite often executed. As such we cache the method names which are coming from tokens here in this array.