MediaWiki REL1_31
ClassCollector Class Reference

Reads PHP code and returns the FQCN of every class defined within it. More...

Collaboration diagram for ClassCollector:

Public Member Functions

 getClasses ( $code)
 

Protected Member Functions

 implodeTokens ()
 Returns the string representation of the tokens within the current expect sequence and resets the sequence.
 
 tryBeginExpect ( $token)
 Determine if $token begins the next expect sequence.
 
 tryEndExpect ( $token)
 Accepts the next token in an expect sequence.
 

Protected Attributes

array $alias
 Class alias with target/name fields.
 
array $classes
 List of FQCN detected in this pass.
 
string $namespace = ''
 Current namespace.
 
array $startToken
 Token from token_get_all() that started an expect sequence.
 
array $tokens
 List of tokens that are members of the current expect sequence.
 

Detailed Description

Reads PHP code and returns the FQCN of every class defined within it.

Definition at line 333 of file AutoloadGenerator.php.

Member Function Documentation

◆ getClasses()

ClassCollector::getClasses ( $code)
Parameters
string$codePHP code (including <?php) to detect class names from
Returns
array List of FQCN detected within the tokens

Definition at line 364 of file AutoloadGenerator.php.

References $classes, $code, classes, tryBeginExpect(), and tryEndExpect().

◆ implodeTokens()

ClassCollector::implodeTokens ( )
protected

Returns the string representation of the tokens within the current expect sequence and resets the sequence.

Returns
string

Definition at line 497 of file AutoloadGenerator.php.

Referenced by tryEndExpect().

◆ tryBeginExpect()

ClassCollector::tryBeginExpect ( $token)
protected

Determine if $token begins the next expect sequence.

Parameters
array$token

Definition at line 387 of file AutoloadGenerator.php.

Referenced by getClasses().

◆ tryEndExpect()

ClassCollector::tryEndExpect ( $token)
protected

Accepts the next token in an expect sequence.

Parameters
array$token

Definition at line 414 of file AutoloadGenerator.php.

References classes, false, and implodeTokens().

Referenced by getClasses().

Member Data Documentation

◆ $alias

array ClassCollector::$alias
protected

Class alias with target/name fields.

Definition at line 358 of file AutoloadGenerator.php.

◆ $classes

array ClassCollector::$classes
protected

List of FQCN detected in this pass.

Definition at line 343 of file AutoloadGenerator.php.

Referenced by getClasses().

◆ $namespace

string ClassCollector::$namespace = ''
protected

Current namespace.

Definition at line 338 of file AutoloadGenerator.php.

◆ $startToken

array ClassCollector::$startToken
protected

Token from token_get_all() that started an expect sequence.

Definition at line 348 of file AutoloadGenerator.php.

◆ $tokens

array ClassCollector::$tokens
protected

List of tokens that are members of the current expect sequence.

Definition at line 353 of file AutoloadGenerator.php.


The documentation for this class was generated from the following file: