Wrapper that calls the parent function with file fixtures (if enabled)

@param string $functionName
@param array $arguments
@param array $resultArguments
@throws \Exception
@return mixed
332566
protected function callWithFixtures($functionName, array $arguments = array(), &$resultArguments = null)
    {
        if ($this->usesFixtures()) {
            // Determine fixture file name
            $fingerprintArguments = $this->getFixtureFingerprintArguments($arguments);
            $fixture = new FileFixture($this->_fixturePath . FileFixture::getFilename($this->getFixturePrefix() . '_' . $functionName, $fingerprintArguments));

            // Try to find existing fixture file
            try {
                $fixture->find();

                $result = $fixture->getResult();

                // Throw exception or return value?
                if (is_object($result) && $result instanceof \Exception) {
                    throw $result;
                }

                $resultArguments = $fixture->getArguments();

                return $result;
            } catch (FixtureNotFoundException $e) {
                // No fixture found, the original method has to be called
            }
        }

        if ($this->fixtureOfflineModeEnabled()) {
            throw new OfflineException('Can not create fixture for ' . $functionName . '() in offline mode');
        }

        $throwException = false;

        // Catch exceptions to be able to create fixtures for them as well
        try {
            $result = call_user_func_array(array($this->_fixtureInstance, $functionName), $arguments);
        } catch (\Exception $e) {
            $result = $e;
            $throwException = true;
        }

        // Write return value / exception to file fixture
        if ($this->usesFixtures()) {
            $resultArguments = $arguments;
            $fixture->setResult($result);
            $fixture->setArguments($arguments);
            $fixture->save();
        }

        // Throw exception or return value?
        if ($throwException) {
            throw $result;
        }

        return $result;
    }
116743
public function call($name, $arguments = [])
    {
        return $this->runViaLaravelCollection(function ($collection) use (
            $name,
            $arguments
        ) {
            return call_user_func_array(
                [$collection, $name],
                $this->coollectizeCallbacks($this->__toArray($arguments), $name)
            );
        },
        $name);
    }
135480
public function callWith($callback, Arguments $arguments)
    {
        if ($callback instanceof Invocable) {
            return $callback->invokeWith($arguments);
        }

        $arguments = $arguments->all();

        return $callback(...$arguments);
    }
185127
function writeFileFromFile($filename, $localFilename, $multicall = false)
    {
        if (!file_exists($localFilename)) {
            throw new InvalidArgumentException('localFilename = ' . print_r($localFilename, true));
        }

        $contents = file_get_contents($localFilename);
        return $this->writeFile($filename, $contents, $multicall);
    }
397029
public function getFunction($type, array $args = [])
    {
        $chain = clone $this->chain;
        while ($chain) {
            /** @var TypeResolverInterface $resolver */
            $resolver = $chain->current();
            try {
                $function = $resolver->getFunction($type, $args);
                if ($function instanceof FunctionProviderInterface) {
                    return $function;
                }
            } catch (\Exception $e) {
                if (!$this->getFlagIgnoreException()) {
                    throw new Exception\RuntimeException($e->getMessage(), $e->getCode(), $e);
                }
            }
            $chain->next();
        }

        $errMsg = sprintf('Function for type %s not found', $type);
        throw new Exception\ResultNotFoundException($errMsg);
    }
171692
public function callFunction($functionName, $parameters)
    {
        if ($functionName == 'getList') {
            $oObject = $this->getObject();
            $mResponse = $this->_formArrayFromList($oObject->getList());
        } else {
            $mResponse = parent::callFunction($functionName, $parameters);
        }

        return $mResponse;
    }
1339814
public static function fun($functionName, $arguments = [])
    {
        if (2 === func_num_args()) {
            $arguments = (array) $arguments;
        } else {
            $arguments = func_get_args();
            $functionName = array_shift($arguments);
        }

        return new PlatformFunction($functionName, $arguments);
    }
1077227
private function call($name, array $arguments = array())
    {
        $startTime = microtime(true);
        $result = call_user_func_array("parent::$name", $arguments);
        $duration = (microtime(true) - $startTime) * 1000;

        if (null !== $this->logger) {
            $this->logger->logCommand($this->getCommandString($name, $arguments), $duration, $this->alias, false);
        }

        return $result;
    }
927222
public function invokeWith($arguments = [])
    {
        if (!$arguments instanceof Arguments) {
            $arguments = new Arguments($arguments);
        }

        if (!$this->isRecording) {
            return $this->invoker->callWith($this->callback, $arguments);
        }

        $call = $this->callFactory->record($this->callback, $arguments, $this);
        $responseEvent = $call->responseEvent();

        if ($responseEvent instanceof ThrewEvent) {
            $call->setEndEvent($responseEvent);

            throw $responseEvent->exception();
        }

        $returnValue = $responseEvent->value();

        if ($this->useGeneratorSpies && $returnValue instanceof Generator) {
            return $this->generatorSpyFactory->create($call, $returnValue);
        }

        if (
            $this->useIterableSpies &&
            (is_array($returnValue) || $returnValue instanceof Traversable)
        ) {
            return $this->iterableSpyFactory->create($call, $returnValue);
        }

        $call->setEndEvent($call->responseEvent());

        return $returnValue;
    }
1288226
public function fire(string $name, ...$functionArguments)
    {
        $name = $this->normalizeName($name);
        if (isset($this->stack[$name])) {
            $event = $this->stack[$name];

            // remove if once
            if ($event->isOnce()) {
                $this->off($name);
            }

            $function = $event->getFunction();
            $functionArguments = array_merge($event->getFunctionArguments(), $functionArguments);

            return call_user_func_array($function, $functionArguments);
        }

        return null; // no event found
    }
228308
public function method($methodName, $arg1/*, $arg2, $arg3, ...*/)
    {
        $args = array_slice(func_get_args(), 1);

        return $this->func(function($object) use ($methodName, $args) {
            return call_user_func_array([$object, $methodName], $args);
        });
    }
150292
protected function getCallArgs(array $arguments, array $extraArguments, $value = null): array
    {
        foreach ($extraArguments as $name => $val) {
            $arguments[] = $val;
        }

        return $arguments;
    }
776620
public function evaluate(Context $context, $arity, $arguments) {
		if($arity != 1) {
			throw new FunctionCallException(
				'htmlentities',
				'Expects exactly 1 argument.',
				$context->getFilename(),
				$context->tag->getLineNumber()
			);
		}

		$string = $arguments[0];
		return htmlentities($string);
	}
1168652
public static function getArgumentsForCall($name, $arguments): array
    {
        // uppercase the method name
        $name = strtoupper($name);

        if ($name === 'ANY') {
            // allowed any of the methods
            $name = self::ALLOWED_METHODS;
        } else if (! in_array($name, self::ALLOWED_METHODS)) {
            throw new InvalidArgumentException('Route::method must be one of: ' . implode(', ', self::ALLOWED_METHODS));
        }

        // add the name to the arguments
        array_unshift($arguments, $name);

        // return the arguments
        return $arguments;
    }
861766
public function checkCalledWith(...$arguments): ?EventCollection
    {
        $cardinality = $this->resetCardinality();

        $matchers = $this->matcherFactory->adaptAll($arguments);
        $calls = $this->spy->allCalls();
        $matchingEvents = [];
        $totalCount = count($calls);
        $matchCount = 0;

        foreach ($calls as $call) {
            if (
                $this->matcherVerifier
                    ->matches($matchers, $call->arguments()->all())
            ) {
                $matchingEvents[] = $call;
                ++$matchCount;
            }
        }

        if ($cardinality->matches($matchCount, $totalCount)) {
            return $this->assertionRecorder->createSuccess($matchingEvents);
        }

        return null;
    }
56784
private function hasTooManyArguments(array $argumentValues, array $commandArguments) : bool
    {
        if (count($argumentValues) > count($commandArguments)) {
            // Only when the last argument is an array do we allow more request arguments than command arguments
            if (count($commandArguments) === 0 || !end($commandArguments)->isArray()) {
                return true;
            }
        }

        return false;
    }
913432
public function registerCustomPlaceholder(array $resultKeys, $placeholderName, $placeholderFunction)
    {
        if (!is_callable($placeholderFunction, true)) {
            throw new \InvalidArgumentException('Placeholder function is not callable');
        }

        foreach ($resultKeys as $resultKey) {
            if (!isset($this->customPlaceholders[$resultKey])) {
                $this->customPlaceholders[$resultKey] = [];
            }
            $this->customPlaceholders[$resultKey][$placeholderName] = $placeholderFunction;
        }
    }