Function's arguments:
string to escape

@param Context $context
@param integer $arity
@param array $arguments
@return mixed|string
@throws FunctionCallException
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);
	}
1306728
public function execute(callable $function, array $arguments = [])
    {
        $delayFunction = $this->delayFunction;
        $retryAttempt = 0;

        $continue = true;
        do {
            try {
                $res = call_user_func_array($function, $arguments);
                $continue = false;
                return $res;
            } catch (\Exception $exception) {
                if ($this->retryFunction) {
                    if (!call_user_func($this->retryFunction, $exception)) {
                        throw $exception;
                    }
                }

                if ($retryAttempt < $this->retries) {
                    $delay = $delayFunction($exception);
                    $delay += [
                        'seconds' => 0,
                        'nanos' => 0
                    ];

                    time_nanosleep($delay['seconds'], $delay['nanos']);

                    $retryAttempt++;
                } else {
                    $continue = false;
                    throw $exception;
                }
            }
        } while ($continue);
    }
1128137
public static function escape(array $args): string
  {
    $command = '';
    foreach ($args as $arg)
    {
      if ($command!='') $command .= ' ';
      $command .= escapeshellarg($arg);
    }

    return $command;
  }
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;
    }
1085080
protected function assertArgumentRequirement($key, $regex, $arguments)
    {
        if (substr($regex, -1) === '+' && !array_key_exists($key, $arguments)) {
            throw new RouteException(sprintf('Missing value for argument "%s" in route "%s"', $key, $this->pattern));
        }
    }
1050425
public function escape($string, $functions = null)
    {
        static $flags;

        if (!isset($flags)) {
            $flags = ENT_QUOTES | ENT_SUBSTITUTE;
        }

        if ($functions) {
            $string = $this->batch($string, $functions);
        }

        return htmlspecialchars($string, $flags, 'UTF-8');
    }
91390
public static function call(string $function, Arguments $arguments)
    {
        $mocks = self::$mocks;

        $mocks = array_filter($mocks, function (MockedFunction $mock) use ($function) {
            return $mock->getFunctionName() === $function;
        });

        # First try functions that expect the exact arguments, and have expectations that haven't been called yet
        foreach ($mocks as $mock) {
            if ($mock->matchArguments($arguments)) {
                if ($mock->canCall()) {
                    return $mock->call($arguments);
                }
            }
        }

        # Then try functions that expect any arguments, and have expectations that haven't been called yet
        foreach ($mocks as $mock) {
            if ($mock->canAcceptArguments($arguments)) {
                if ($mock->canCall()) {
                    return $mock->call($arguments);
                }
            }
        }

        # Now try functions that expect the exact arguments (so we can give an accurate error message)
        foreach ($mocks as $mock) {
            if ($mock->matchArguments($arguments)) {
                return $mock->call($arguments);
            }
        }

        # Finally try functions that expect any arguments (just so we can throw an error as there are no expectations left)
        foreach ($mocks as $mock) {
            if ($mock->canAcceptArguments($arguments)) {
                return $mock->call($arguments);
            }
        }

        throw new ExpectationException("Unexpected argument list for {$function}({$arguments})");
    }
560151
public function start(Context $context, array $args = []): Promise
    {
        $factory = $context->lookup(ProcessFactory::class);
        
        if ($factory === null) {
            throw new \RuntimeException('Cannot launch an async process without a process factory');
        }
        
        $options = [];
        
        foreach ($this->options as $k => $v) {
            if (\strlen($k) === 1) {
                $name = '-' . $k;
            } else {
                $name = '--' . $k;
            }
            
            if ($v === null) {
                $options[] = $name;
            } else {
                foreach ($v as $val) {
                    $options[] = $name;
                    $options[] = $val;
                }
            }
        }
        
        return $context->task($factory->createProcess($context, $this->command, \array_merge($options, $args), $this->dir, $this->env));
    }
434096
public function resolveArguments($callable, array $context) {
        $resolve_arg = $this->resolve_arg;

        $rf = $this->callableToReflectionFunctionAbstract($callable);

        $args = [];
        foreach ($rf->getParameters() as $i => $arg_meta) {
            $arg = $resolve_arg($arg_meta, $context);
            if (!count($arg) && $arg_meta->isOptional()) {
                continue;
            } else if (!count($arg)) {
                throw new Exception\ResolutionException($arg_meta);
            }

            $args[] = $arg[0];
        }

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

        return $this->callTraitMethod->invoke(
            $this->mock,
            $this->traitName,
            $this->name,
            $arguments
        );
    }
202808
public function call($method, array $arguments = [])
    {
        if ($this->value === null) {
            return null;
        } elseif (is_object($this->value)) {
            $callback = [$this->value, $method];
        } elseif (is_array($this->value)) {
            if (!array_key_exists($method, $this->value)) {
                throw new EvaluationException('Array has no function "' . $method . '"', 1344350459);
            }
            $callback = $this->value[$method];
        } else {
            throw new EvaluationException('Needs object or array to call method "' . $method . '", but has ' . gettype($this->value), 1344350454);
        }
        if (!is_callable($callback)) {
            throw new EvaluationException('Method "' . $method . '" is not callable', 1344350374);
        }
        $argumentsCount = count($arguments);
        for ($i = 0; $i < $argumentsCount; $i++) {
            if ($arguments[$i] instanceof Context) {
                $arguments[$i] = $arguments[$i]->unwrap();
            }
        }
        return call_user_func_array($callback, $arguments);
    }
290505
public static function escapeShellArg($arg, $escapeFor = NULL) {
    $escaped = \Symfony\Component\Process\ProcessUtils::escapeArgument($arg);

    return Preg::replace($escaped, '~(?<!\\\\)\\\\"$~', '\\\\\\"');
  }
649547
function(arg, context) {
		switch (gui.Type.of(arg)) {
			case "function":
				return [arg];
			case "string":
				return this._breakarray(arg.split(" "), context);
			case "object":
				console.error("Expected function. Got object.");
		}
	}
255057
function sendModeScriptCommands($commands, $multicall = false)
    {
        if (!is_array($commands) || !$commands) {
            throw new InvalidArgumentException('commands = ' . print_r($commands, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($commands), $multicall);
    }
621770
public function removeArgument(IArgument $arg): IRequest
    {
        if ($arg instanceof IMergeableArgument) {
            if (!isset($this->mergeableArguments[$arg->getKey()])) {
                throw new \InvalidArgumentException("This argument doesn't exists");
            }
            $this->mergeableArguments[$arg->getKey()]->removeArgument($arg);

            if ($this->mergeableArguments[$arg->getKey()]->isEmpty()) {
                unset($this->mergeableArguments[$arg->getKey()]);
            }
        } elseif ($arg instanceof IStackableArgument) {
            if (!isset($this->stackableArguments[$arg->getKey()])) {
                throw new \InvalidArgumentException("This argument doesn't exists");
            }
            $this->stackableArguments[$arg->getKey()]->removeArgument($arg);

            if ($this->stackableArguments[$arg->getKey()]->isEmpty()) {
                unset($this->stackableArguments[$arg->getKey()]);
            }
        } else {
            unset($this->arguments[$arg->getKey()]);
        }

        return $this;
    }
1011677
private function escape(array $arguments)
    {
        $args = array();
        foreach ($arguments as $k => $v) {
            if (is_array($v)) {
                $args[$k] = $this->escape($v);
            } elseif (is_string($v)) {
                $args[$k] = str_replace('%', '%%', $v);
            } else {
                $args[$k] = $v;
            }
        }

        return $args;
    }
1164520
function exec (func, context, args) {
	switch (args.length) {
		case 0: func.call(context); break;
		case 1: func.call(context, args[0]); break;
		case 2: func.call(context, args[0], args[1]); break;
		case 3: func.call(context, args[0], args[1], args[2]); break;
		case 4: func.call(context, args[0], args[1], args[2], args[3]); break;
		default: func.apply(context, args); break;
	}
}