Overview

Namespaces

  • TokenReflection
    • Broker
      • Backend
    • Dummy
    • Exception
    • Invalid
    • Php
    • Stream

Classes

  • Broker
  • ReflectionAnnotation
  • ReflectionBase
  • ReflectionClass
  • ReflectionConstant
  • ReflectionElement
  • ReflectionFile
  • ReflectionFileNamespace
  • ReflectionFunction
  • ReflectionFunctionBase
  • ReflectionMethod
  • ReflectionNamespace
  • ReflectionParameter
  • ReflectionProperty
  • Resolver

Interfaces

  • IReflection
  • IReflectionClass
  • IReflectionConstant
  • IReflectionExtension
  • IReflectionFunction
  • IReflectionFunctionBase
  • IReflectionMethod
  • IReflectionNamespace
  • IReflectionParameter
  • IReflectionProperty
  • Overview
  • Namespace
  • Class
  • Tree
  • Download

Class Broker

Reflection broker.

Parses files and directories and stores their structure.

Namespace: TokenReflection
Located at Broker.php
Methods summary
public
# __construct( TokenReflection\Broker\Backend $backend, integer $options = TokenReflection\Broker::OPTION_DEFAULT )

Constructor.

Constructor.

Parameters

$backend
TokenReflection\Broker\Backend
$backend Broker backend instance
$options
integer
$options Broker/parsing options
public integer
# getOptions( )

Returns broker/parser options.

Returns broker/parser options.

Returns

integer
public boolean
# isOptionSet( integer $option )

Returns if a particular option setting is set.

Returns if a particular option setting is set.

Parameters

$option
integer
$option Option setting

Returns

boolean
public boolean|TokenReflection\ReflectionFile
# processString( string $source, string $fileName, boolean $returnReflectionFile = false )

Parses a string with the PHP source code using the given file name and returns the appropriate reflection object.

Parses a string with the PHP source code using the given file name and returns the appropriate reflection object.

Parameters

$source
string
$source PHP source code
$fileName
string
$fileName Used file name
$returnReflectionFile
boolean
$returnReflectionFile Returns the appropriate \TokenReflection\ReflectionFile instance(s)

Returns

boolean|TokenReflection\ReflectionFile
public boolean|TokenReflection\ReflectionFile
# processFile( string $fileName, boolean $returnReflectionFile = false )

Parses a file and returns the appropriate reflection object.

Parses a file and returns the appropriate reflection object.

Parameters

$fileName
string
$fileName Filename
$returnReflectionFile
boolean
$returnReflectionFile Returns the appropriate \TokenReflection\ReflectionFile instance(s)

Returns

boolean|TokenReflection\ReflectionFile

Throws

TokenReflection\Exception\BrokerException
If the file could not be processed.
public boolean|array
# processPhar( string $fileName, boolean $returnReflectionFile = false )

Processes a PHAR archive.

Processes a PHAR archive.

Parameters

$fileName
string
$fileName Archive filename.
$returnReflectionFile
boolean
$returnReflectionFile Returns the appropriate \TokenReflection\ReflectionFile instance(s)

Returns

boolean|array
of \TokenReflection\ReflectionFile

Throws

TokenReflection\Exception\BrokerException
If the PHAR PHP extension is not loaded.
TokenReflection\Exception\BrokerException
If the given archive could not be read.
TokenReflection\Exception\BrokerException
If the given archive could not be processed.
public boolean|array
# processDirectory( string $path, string|array $filters = array(), boolean $returnReflectionFile = false )

Processes recursively a directory and returns an array of file reflection objects.

Processes recursively a directory and returns an array of file reflection objects.

Parameters

$path
string
$path Directora path
$filters
string|array
$filters Filename filters
$returnReflectionFile
boolean
$returnReflectionFile Returns the appropriate \TokenReflection\ReflectionFile instance(s)

Returns

boolean|array
of \TokenReflection\ReflectionFile

Throws

TokenReflection\Exception\BrokerException
If the given directory does not exist.
TokenReflection\Exception\BrokerException
If the given directory could not be processed.
public boolean|array|TokenReflection\ReflectionFile
# process( string $path, boolean $returnReflectionFile = false )

Process a file, directory or a PHAR archive.

Process a file, directory or a PHAR archive.

Parameters

$path
string
$path Path
$returnReflectionFile
boolean
$returnReflectionFile Returns the appropriate \TokenReflection\ReflectionFile instance(s)

Returns

boolean|array|TokenReflection\ReflectionFile

Throws

TokenReflection\Exception\BrokerException
If the target does not exist.
public boolean
# hasNamespace( string $namespaceName )

Returns if the broker contains a namespace of the given name.

Returns if the broker contains a namespace of the given name.

Parameters

$namespaceName
string
$namespaceName Namespace name

Returns

boolean
public TokenReflection\ReflectionNamespace|null
# getNamespace( string $namespaceName )

Returns a reflection object of the given namespace.

Returns a reflection object of the given namespace.

Parameters

$namespaceName
string
$namespaceName Namespace name

Returns

TokenReflection\ReflectionNamespace|null
public boolean
# hasClass( string $className )

Returns if the broker contains a class of the given name.

Returns if the broker contains a class of the given name.

Parameters

$className
string
$className Class name

Returns

boolean
public TokenReflection\ReflectionClass|null
# getClass( string $className )

Returns a reflection object of the given class (FQN expected).

Returns a reflection object of the given class (FQN expected).

Parameters

$className
string
$className CLass bame

Returns

TokenReflection\ReflectionClass|null
public array
# getClasses( integer $types = TokenReflection\Broker\Backend::TOKENIZED_CLASSES )

Returns all classes from all namespaces.

Returns all classes from all namespaces.

Parameters

$types
integer
$types Returned class types (multiple values may be OR-ed)

Returns

array
public boolean
# hasConstant( string $constantName )

Returns if the broker contains a constant of the given name.

Returns if the broker contains a constant of the given name.

Parameters

$constantName
string
$constantName Constant name

Returns

boolean
public TokenReflection\ReflectionConstant|null
# getConstant( string $constantName )

Returns a reflection object of a constant (FQN expected).

Returns a reflection object of a constant (FQN expected).

Parameters

$constantName
string
$constantName Constant name

Returns

TokenReflection\ReflectionConstant|null
public array
# getConstants( )

Returns all constants from all namespaces.

Returns all constants from all namespaces.

Returns

array
public boolean
# hasFunction( string $functionName )

Returns if the broker contains a function of the given name.

Returns if the broker contains a function of the given name.

Parameters

$functionName
string
$functionName Function name

Returns

boolean
public TokenReflection\ReflectionFunction|null
# getFunction( string $functionName )

Returns a reflection object of a function (FQN expected).

Returns a reflection object of a function (FQN expected).

Parameters

$functionName
string
$functionName Function name

Returns

TokenReflection\ReflectionFunction|null
public array
# getFunctions( )

Returns all functions from all namespaces.

Returns all functions from all namespaces.

Returns

array
public boolean
# hasFile( string $fileName )

Returns if the broker contains a file reflection of the given name.

Returns if the broker contains a file reflection of the given name.

Parameters

$fileName
string
$fileName File name

Returns

boolean
public TokenReflection\ReflectionFile|null
# getFile( string $fileName )

Returns a reflection object of a file.

Returns a reflection object of a file.

Parameters

$fileName
string
$fileName File name

Returns

TokenReflection\ReflectionFile|null
public array
# getFiles( )

Returns all processed files reflections.

Returns all processed files reflections.

Returns

array
public TokenReflection\Stream\StreamBase|null
# getFileTokens( string $fileName )

Returns an array of tokens from a processed file.

Returns an array of tokens from a processed file.

Parameters

$fileName
string
$fileName File name

Returns

TokenReflection\Stream\StreamBase|null
public static string|boolean
# getRealPath( string $path )

Returns a real system path.

Returns a real system path.

Parameters

$path
string
$path Source path

Returns

string|boolean
Constants summary
integer OPTION_SAVE_TOKEN_STREAM 0x0001
#

Turns on saving of parsed token streams.

Turns on saving of parsed token streams.

integer OPTION_PARSE_FUNCTION_BODY 0x0002
#

Turns on parsing function/method body.

Turns on parsing function/method body.

This effectively turns on parsing of static variables in functions/methods.

integer OPTION_DEFAULT 0x0003
#

Default options.

Default options.

string CACHE_NAMESPACE 'namespace'
#

Cache identifier for namespaces.

Cache identifier for namespaces.

string CACHE_CLASS 'class'
#

Cache identifier for classes.

Cache identifier for classes.

string CACHE_CONSTANT 'constant'
#

Cache identifier for constants.

Cache identifier for constants.

string CACHE_FUNCTION 'function'
#

Cache identifier for functions.

Cache identifier for functions.

PHP Token Reflection API documentation generated by ApiGen 2.8.0