PhpSandbox\PHPSandbox::prepareNamespaces PHP Méthode

prepareNamespaces() protected méthode

Prepare defined namespaces for execution
protected prepareNamespaces ( )
    protected function prepareNamespaces()
    {
        $output = [];
        foreach ($this->definitions['namespaces'] as $name) {
            if (is_string($name) && $name) {
                $output[] = 'namespace ' . $name . ';';
            } else {
                $this->validationError("Sandboxed code attempted to create invalid namespace: {$name}", Error::DEFINE_NAMESPACE_ERROR, null, $name);
            }
        }
        return count($output) ? implode("\r\n", $output) . "\r\n" : '';
    }
PHPSandbox