phpmock\generator\MockFunctionGenerator::call PHP Method

call() public static method

Calls the enabled mock, or the built-in function otherwise.
See also: Mock::define()
public static call ( string $functionName, string $fqfn, array &$arguments ) : mixed
$functionName string The function name.
$fqfn string The fully qualified function name.
$arguments array The arguments.
return mixed The result of the called function.
    public static function call($functionName, $fqfn, &$arguments)
    {
        $registry = MockRegistry::getInstance();
        $mock = $registry->getMock($fqfn);
        self::removeDefaultArguments($arguments);
        if (empty($mock)) {
            // call the built-in function if the mock was not enabled.
            return call_user_func_array($functionName, $arguments);
        } else {
            // call the mock function.
            return $mock->call($arguments);
        }
    }