Eloquent\Phony\Stub\StubVerifierFactory::createGlobal PHP Метод

createGlobal() публичный Метод

Create a new stub verifier for a global function and declare it in the specified namespace.
public createGlobal ( string $function, string $namespace ) : StubVerifier
$function string The function name.
$namespace string The namespace.
Результат StubVerifier The newly created stub verifier.
    public function createGlobal($function, $namespace)
    {
        if (false !== strpos($function, '\\')) {
            throw new InvalidArgumentException('Only functions in the global namespace are supported.');
        }
        $namespace = trim($namespace, '\\');
        if (!$namespace) {
            throw new InvalidArgumentException('The supplied namespace must not be empty.');
        }
        $stub = $this->stubFactory->create($function);
        $spy = $this->spyFactory->create($stub);
        $this->functionHookManager->defineFunction($function, $namespace, $spy);
        return new StubVerifier($stub, $spy, $this->matcherFactory, $this->matcherVerifier, $this->generatorVerifierFactory, $this->iterableVerifierFactory, $this->callVerifierFactory, $this->assertionRecorder, $this->assertionRenderer, $this->generatorAnswerBuilderFactory);
    }