PHP Класс PhpSandbox\ValidatorVisitor

This class takes parsed AST code and checks it against the passed PHPSandbox instance configuration for errors, and throws exceptions if they are found
Автор: Elijah Horton ([email protected])
Наследование: extends PhpParser\NodeVisitorAbstract
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$sandbox PHPSandbox The PHPSandbox instance to check against

Открытые методы

Метод Описание
__construct ( PHPSandbox $sandbox ) ValidatorVisitor class constructor
leaveNode ( PhpParser\Node $node ) : PhpParser\Node | boolean | null Examine the current PhpParser_Node node against the PHPSandbox configuration for validating sandboxed code

Защищенные методы

Метод Описание
isKeyword ( PhpParser\Node $node ) : string | null Test the current PhpParser_Node node to see if it is a keyword, and return the name if it is and null if it is not
isMagicConst ( PhpParser\Node $node ) : string | null Test the current PhpParser_Node node to see if it is a magic constant, and return the name if it is and null if it is not
isOperator ( PhpParser\Node $node ) : string | null Test the current PhpParser_Node node to see if it is an operator, and return the name if it is and null if it is not
isPrimitive ( PhpParser\Node $node ) : string | null Test the current PhpParser_Node node to see if it is a primitive, and return the name if it is and null if it is not

Описание методов

__construct() публичный Метод

This constructor takes a passed PHPSandbox instance to check against for validating sandboxed code.
public __construct ( PHPSandbox $sandbox )
$sandbox PHPSandbox The PHPSandbox instance to check against

isKeyword() защищенный Метод

Test the current PhpParser_Node node to see if it is a keyword, and return the name if it is and null if it is not
protected isKeyword ( PhpParser\Node $node ) : string | null
$node PhpParser\Node The sandboxed $node to test
Результат string | null Return string name of node, or null if it is not a keyword

isMagicConst() защищенный Метод

Test the current PhpParser_Node node to see if it is a magic constant, and return the name if it is and null if it is not
protected isMagicConst ( PhpParser\Node $node ) : string | null
$node PhpParser\Node The sandboxed $node to test
Результат string | null Return string name of node, or null if it is not a magic constant

isOperator() защищенный Метод

Test the current PhpParser_Node node to see if it is an operator, and return the name if it is and null if it is not
protected isOperator ( PhpParser\Node $node ) : string | null
$node PhpParser\Node The sandboxed $node to test
Результат string | null Return string name of node, or null if it is not an operator

isPrimitive() защищенный Метод

Test the current PhpParser_Node node to see if it is a primitive, and return the name if it is and null if it is not
protected isPrimitive ( PhpParser\Node $node ) : string | null
$node PhpParser\Node The sandboxed $node to test
Результат string | null Return string name of node, or null if it is not a primitive

leaveNode() публичный Метод

Examine the current PhpParser_Node node against the PHPSandbox configuration for validating sandboxed code
public leaveNode ( PhpParser\Node $node ) : PhpParser\Node | boolean | null
$node PhpParser\Node The sandboxed $node to validate
Результат PhpParser\Node | boolean | null Return rewritten node, false if node must be removed, or null if no changes to the node are made

Описание свойств

$sandbox защищенное свойство

The PHPSandbox instance to check against
protected PHPSandbox,phpsandbox $sandbox
Результат PHPSandbox