# \PHPSandboxValidatorVisitor

Validator class for PHP Sandboxes.

This class takes parsed AST code and checks it against the passed PHPSandbox instance configuration for errors, and throws exceptions if they are found

## Summary

Methods
Properties
Constants
__construct()
leaveNode()
No public properties found
No constants found
isMagicConst()
isKeyword()
isOperator()
isPrimitive()
$sandbox
N/A
No private methods found
No private properties found
N/A

File
  ValidatorVisitor.php
Package
  PHPSandbox
Class hierarchy
  \PhpParser\NodeVisitorAbstract
  \PHPSandbox\ValidatorVisitor

## Tags

namespace | PHPSandbox
author | Elijah Horton elijah@corveda.com
version |

## Properties

### $sandbox

    $sandbox : \PHPSandbox\PHPSandbox

The PHPSandbox instance to check against

#### Type

\PHPSandbox\PHPSandbox

#

## Tags

None found

## Methods

### __construct()

    __construct(\PHPSandbox\PHPSandbox  $sandbox)

ValidatorVisitor class constructor

This constructor takes a passed PHPSandbox instance to check against for validating sandboxed code.

#### Parameters

\PHPSandbox\PHPSandbox | $sandbox | The PHPSandbox instance to check against

#

## Tags

None found

### leaveNode()

    leaveNode(\PhpParser\Node  $node) : \PhpParser\Node|boolean|null

Examine the current PhpParser_Node node against the PHPSandbox configuration for validating sandboxed code

#### Parameters

\PhpParser\Node | $node | The sandboxed $node to validate

#### Throws

\PHPSandbox\Error

  Throws an exception if validation fails

#### Returns

\PhpParser\Node|boolean|null —

Return rewritten node, false if node must be removed, or null if no changes to the node are made

#

## Tags

None found

### isMagicConst()

    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

#### Parameters

\PhpParser\Node | $node | The sandboxed $node to test

#### Returns

string|null —

Return string name of node, or null if it is not a magic constant

#

## Tags

None found

### isKeyword()

    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

#### Parameters

\PhpParser\Node | $node | The sandboxed $node to test

#### Returns

string|null —

Return string name of node, or null if it is not a keyword

#

## Tags

None found

### isOperator()

    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

#### Parameters

\PhpParser\Node | $node | The sandboxed $node to test

#### Returns

string|null —

Return string name of node, or null if it is not an operator

#

## Tags

None found

### isPrimitive()

    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

#### Parameters

\PhpParser\Node | $node | The sandboxed $node to test

#### Returns

string|null —

Return string name of node, or null if it is not a primitive

#

## Tags

None found

### ValidatorVisitor.php