MediaWiki master
MediaWiki\Autoload\ClassCollector Class Reference

Read a PHP file and return the FQCN of every class defined within it. More...

Public Member Functions

 getClasses ( $code)
 

Protected Member Functions

 tryBeginExpect ( $token)
 Determine if $token begins the next expect sequence.
 
 tryEndExpect ( $token)
 Accepts the next token in an expect sequence.
 

Protected Attributes

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

Detailed Description

Read a PHP file and return the FQCN of every class defined within it.

Access: internal
For use by AutoloadGenerator

Definition at line 15 of file ClassCollector.php.

Member Function Documentation

◆ getClasses()

MediaWiki\Autoload\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 46 of file ClassCollector.php.

References MediaWiki\Autoload\ClassCollector\$classes, $matches, MediaWiki\Autoload\ClassCollector\tryBeginExpect(), and MediaWiki\Autoload\ClassCollector\tryEndExpect().

◆ tryBeginExpect()

MediaWiki\Autoload\ClassCollector::tryBeginExpect ( $token)
protected

Determine if $token begins the next expect sequence.

Parameters
array$token

Definition at line 94 of file ClassCollector.php.

Referenced by MediaWiki\Autoload\ClassCollector\getClasses().

◆ tryEndExpect()

MediaWiki\Autoload\ClassCollector::tryEndExpect ( $token)
protected

Accepts the next token in an expect sequence.

Parameters
array | string$token

Definition at line 123 of file ClassCollector.php.

References MediaWiki\Autoload\implodeTokens().

Referenced by MediaWiki\Autoload\ClassCollector\getClasses().

Member Data Documentation

◆ $alias

array null MediaWiki\Autoload\ClassCollector::$alias
protected

Class alias with target/name fields.

Definition at line 40 of file ClassCollector.php.

◆ $classes

array MediaWiki\Autoload\ClassCollector::$classes
protected

List of FQCN detected in this pass.

Definition at line 25 of file ClassCollector.php.

Referenced by MediaWiki\Autoload\ClassCollector\getClasses().

◆ $namespace

string MediaWiki\Autoload\ClassCollector::$namespace = ''
protected

Current namespace.

Definition at line 20 of file ClassCollector.php.

◆ $startToken

array null MediaWiki\Autoload\ClassCollector::$startToken
protected

Token from token_get_all() that started an expect sequence.

Definition at line 30 of file ClassCollector.php.

◆ $tokens

array [] string [] MediaWiki\Autoload\ClassCollector::$tokens
protected

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

Definition at line 35 of file ClassCollector.php.


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