PhpSandbox\PHPSandbox::call_func PHP Method

call_func() public method

Get PHPSandbox redefined function. This is an internal PHPSandbox function but requires public access to work.
public call_func ( ) : mixed
return mixed Returns the redefined function result
    public function call_func()
    {
        $arguments = func_get_args();
        $name = array_shift($arguments);
        $original_name = $name;
        $name = $this->normalizeFunc($name);
        if (isset($this->definitions['functions'][$name]) && is_callable($this->definitions['functions'][$name]['function'])) {
            $function = $this->definitions['functions'][$name]['function'];
            if ($this->definitions['functions'][$name]['pass_sandbox']) {
                //pass the PHPSandbox instance to the defined function?
                array_unshift($arguments, $this);
                //push PHPSandbox instance into first argument so user can test against it
            }
            return call_user_func_array($function, $arguments);
        }
        if (is_callable($name)) {
            return call_user_func_array($name, $arguments);
        }
        return $this->validationError("Sandboxed code attempted to call invalid function: {$original_name}", Error::VALID_FUNC_ERROR, null, $original_name);
    }
PHPSandbox