RPC请求入口

@param array $arguments
@return \Generator
540098
public function actionIndex(...$arguments)
    {
        if ($this->getContext()->getInput()->getHeader('x-rpc') && isset($arguments[0])) {
            $this->parseHttpArgument($arguments);
            yield $this->runMethod();
        } else {
            $this->outputJson([], 400);
        }
    }
1263166
public function arguments(array $arguments = [])
    {
        if (empty($arguments)) {
            return $this->arguments;
        }

        foreach ($arguments as $key => $value) {
            if (!isset($this->requirements[$key])) {
                $this->arguments[$key] = $value;
                continue;
            }

            $this->assertArgumentValue($key, $this->requirements[$key], $value);
            $this->arguments[$key] = $value;
        }

        return $this->arguments;
    }
903173
public function rawSQL(array $arguments)
    {
        // Small fixes if only query provided
        $this->setRawDefaults($arguments);

        /*
         * @param string $query  pure sql query
         * @param  array $bind   array with values in [':key' => 'value'] format
         * @param   bool $fetch  make fetch and return data?
         */
        list($query, $bind, $fetch) = $arguments;

        // Set statement
        $statement = $this->getInstance()->prepare($query);

        // Execute operation
        $statement->execute($bind);

        return (true === $fetch)
            // Return object
            ? $statement->fetchAll(PDO::FETCH_OBJ)
            // Return count of affected rows
            : $statement->rowCount();
    }
310142
public function setCommandArguments(array $arguments)
    {
        $orderedArguments = [];
        foreach ($arguments as $index => $argument) {
            if (!($argument instanceof Parameter\Argument)) {
                throw new \Parable\Console\Exception(
                    "Arguments must be instances of Parameter\\Argument. The item at index {$index} is not."
                );
            }

            $argument->setOrder($index);
            $orderedArguments[$index] = $argument;
        }
        $this->commandArguments = $orderedArguments;

        return $this;
    }
1288156
public function invokeWith($arguments = [])
    {
        if ($this->exception) {
            throw $this->exception;
        }

        if ($this->isUncallable) {
            return $this->returnValue;
        }

        if (!$arguments instanceof Arguments) {
            $arguments = new Arguments($arguments);
        }

        return $this->callMagicMethod
            ->invoke($this->mock, $this->name, $arguments);
    }
199504
public function query(array $arguments = [])
    {
        $adaptees = get_terms(['taxonomy' => $this->getSlug()]);

        return $this->plugger
            ->setModel($this)
            ->setAdapter(Term::class)
            ->plugIn($adaptees)
            ->getConnected();
    }
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;
    }
378868
public function parse(Array $arguments)
    {
        $this->arguments = array();
        $arguments = new ArgumentIterator($arguments);

        foreach ($arguments as $current) {

            $arguments->next();
            $next = ($arguments->valid() ? $arguments->current() : '');
            $arguments->prev();

            $arg1 = substr($current, 0, 1);
            $arg2 = substr($current, 0, 2);

            if ('--' == $arg2) {

                // ~ Case '--test'
                $arg = array();
                $match = preg_match('`--([0-9a-z_-]+)="?(.+)"?`', $current, $arg);

                if ($match > 0) {
                    $this->arguments[$arg[1]] = $arg[2];
                } else
                    if (! empty($next) && '-' !== substr($next, 0, 1)) {
                        $this->arguments[substr($current, 2)] = $next;
                    } else {
                        $this->arguments[substr($current, 2)] = true;
                    }
            } elseif ('-' == $arg1) {

                // ~ case -t
                $arg = substr($current, 1);
                $len = strlen($arg);

                if (1 == $len && ! empty($next) && '-' != substr($next, 0, 1)) {
                    $this->arguments[$arg] = $next;
                } else {
                    for ($letter = 0; $letter < $len; $letter ++) {
                        $this->arguments[$arg[$letter]] = true;
                    }
                }
            }
        }

        return $this;
    }
175568
protected function process(array $arguments = [])
    {
        return new Process(
            array_merge([realpath($this->driver)], $arguments), null, $this->chromeEnvironment()
        );
    }
910109
public function addAuthHeader($arguments)
    {
        $authentication = [
            'Username' => $this->username,
            'Password' => $this->password,
            'Company' => $this->company,
        ];

        $query = array_merge($authentication, $arguments);

        return $query;
    }
1050661
public static function cli($args)
    {
        $cwd = getcwd();
        $cli = new self($cwd);

        return $cli->run(array_slice($args, 1));
    }
1129398
protected function makeMultiple(array $arguments)
    {
        $result = [];
        foreach ($arguments as $argumentName => $argument) {
            $result[$argumentName] = $argument['type'] = new ListType($argument['type']);
        }

        return $result;
    }
83216
protected function buildUrl(array $arguments)
    {
        $url = strtr($this->builders['pattern'], $this->buildUrlRequirements($arguments));
        $url = str_replace('//', '/', $url);

        $query = array_filter($arguments);
        if (!empty($query)) {
            $url .= '?' . http_build_query($query, null, '&');
        }

        $url = ltrim($url, './');

        return $url;
    }
707422
protected function parseHttpArgument($arguments)
    {
        if ($this->isRpc) {
            $unPackArgs = (array)getInstance()->pack->unPack($arguments[0]);
            if (!isset($unPackArgs['handler'])) {
                throw new Exception('Rpc argument of handler not set.');
            }
            if (!isset($unPackArgs['method'])) {
                throw new Exception('Rpc argument of method not set.');
            }
            if (!isset($unPackArgs['args'])) {
                throw new Exception('Rpc argument of args not set.');
            }
            $this->version   = $unPackArgs['version'] ?? null;
            $this->handler   = $unPackArgs['handler'];
            $this->method    = $unPackArgs['method'];
            $this->reqParams = (array)$unPackArgs['args'];
            $this->construct = (array)$unPackArgs['construct'];
            $this->rpcTime   = $unPackArgs['time'];
        }
    }
539939
public function run(array $args)
    {
        print PHP_EOL;

        $command = 'help';

        //as in 'eve generate'
        if(isset($args[1])) {
            $command = $args[1];
        }

        $class = '\\Eve\\Framework\\Cli\\'.ucwords($command);

        if(!class_exists($class)) {
            self::error('No such command `'.$command.'` found.');
        }

        array_shift($args);
        $runner = new $class($this->cwd);

        $results = $runner->run($args);

        print PHP_EOL;

        return $results;
    }
1136878
public function make($currentPage, array $arguments = [])
    {
        $this->currentPage = $currentPage ?: get_query_var('paged');

        $this->setArguments(array_merge($arguments, $this->getDefaults()));
        $this->setLinks($this->getPaginationLinks());

        return $this->generate();
    }
559209
protected function mapArguments(array $arguments)
    {
        $keys = isset($this->mappableArguments[$this->element()]) ? $this->mappableArguments[$this->element()] : [];

        return array_combine(array_slice($keys, 0, count($arguments)), $arguments);
    }