ClassPreloader\ClassPreloader::getCodeWrappedIntoNamespace PHP Method

getCodeWrappedIntoNamespace() protected method

Wrap the code into a namespace.
protected getCodeWrappedIntoNamespace ( array $parsed, string $pretty ) : string
$parsed array
$pretty string
return string
    protected function getCodeWrappedIntoNamespace(array $parsed, $pretty)
    {
        if ($this->parsedCodeHasNamespaces($parsed)) {
            $pretty = preg_replace('/^\\s*(namespace.*);/im', '${1} {', $pretty, 1) . "\n}\n";
        } else {
            $pretty = sprintf("namespace {\n%s\n}\n", $pretty);
        }
        return preg_replace('/(?<!.)[\\r\\n]+/', '', $pretty);
    }