PHP Class Kahlan\Jit\Patcher\Monkey

Afficher le fichier Open project: crysalead/kahlan Class Usage Examples

Protected Properties

Свойство Type Description
$_blacklist array Ignoring the following statements which are not valid function or class names.
$_counter integer Counter for building unique variable name.
$_depth integer Nested function depth level.
$_prefix string Prefix to use for custom variable name.
$_regex string The regex.
$_uses array Uses for the parsed node's namespace.
$_variables array Variables for the parsed node.

Méthodes publiques

Méthode Description
__construct ( $config = [] ) The constructor.
blacklisted ( string $name = null ) : boolean Check if a function is part of the blacklisted ones.
findFile ( object $loader, string $class, string $file ) : string The JIT find file patcher.
patchable ( string $class ) : boolean The JIT patchable checker.
process ( object $node, string $path = null ) : object The JIT patcher.

Méthodes protégées

Méthode Description
_addClosingParenthesis ( $pos, integer $index, array $parent ) : boolean Add a closing parenthesis
_flushVariables ( array $node ) Flush stored variables in the passed node.
_monkeyPatch ( object $node, array $parent, integer $index ) Monkey patch a node body.
_processTree ( $parent ) Helper for Monkey::process().

Method Details

__construct() public méthode

The constructor.
public __construct ( $config = [] )

_addClosingParenthesis() protected méthode

Add a closing parenthesis
protected _addClosingParenthesis ( $pos, integer $index, array $parent ) : boolean
$index integer The index of node in parent children.
$parent array The parent array.
Résultat boolean Returns `true` if succeed, `false` otherwise.

_flushVariables() protected méthode

Flush stored variables in the passed node.
protected _flushVariables ( array $node )
$node array The node to store variables in.

_monkeyPatch() protected méthode

Monkey patch a node body.
protected _monkeyPatch ( object $node, array $parent, integer $index )
$node object The node to monkey patch.
$parent array The parent array.
$index integer The index of node in parent children.

_processTree() protected méthode

Helper for Monkey::process().
protected _processTree ( $parent )

blacklisted() public static méthode

Check if a function is part of the blacklisted ones.
public static blacklisted ( string $name = null ) : boolean
$name string A function name.
Résultat boolean

findFile() public méthode

The JIT find file patcher.
public findFile ( object $loader, string $class, string $file ) : string
$loader object The autloader instance.
$class string The fully-namespaced class name.
$file string The correponding finded file path.
Résultat string The patched file path.

patchable() public méthode

The JIT patchable checker.
public patchable ( string $class ) : boolean
$class string The fully-namespaced class name to check.
Résultat boolean

process() public méthode

The JIT patcher.
public process ( object $node, string $path = null ) : object
$node object The node instance to patch.
$path string The file path of the source code.
Résultat object The patched node.

Property Details

$_blacklist protected_oe static_oe property

Ignoring the following statements which are not valid function or class names.
protected static array $_blacklist
Résultat array

$_counter protected_oe property

Counter for building unique variable name.
protected int $_counter
Résultat integer

$_depth protected_oe property

Nested function depth level.
protected int $_depth
Résultat integer

$_prefix protected_oe property

Prefix to use for custom variable name.
protected string $_prefix
Résultat string

$_regex protected_oe property

The regex.
protected string $_regex
Résultat string

$_uses protected_oe property

Uses for the parsed node's namespace.
protected array $_uses
Résultat array

$_variables protected_oe property

Variables for the parsed node.
protected array $_variables
Résultat array