setFuncValidator() public method

Validator callable must accept two parameters: a string of the normalized name of the checked element, and the PHPSandbox instance. NOTE: Normalized function names include the namespace and are lowercase!
public setFuncValidator ( callable $callable ) : PHPSandbox
$callable callable Callable that validates the normalized passed function name
return PHPSandbox Returns the PHPSandbox instance for fluent querying
示例#1
0
 /**
  * Test whether sandbox custom function validation succeeds
  */
 public function testCustomFunctionValidationFailure()
 {
     $this->expectException('PHPSandbox\\Error');
     $this->sandbox->setFuncValidator(function ($name) {
         return $name == 'test';
     });
     $this->sandbox->execute(function () {
         test2();
     });
 }