@param array ...$args

@return mixed

@throws \Throwable

@api

@quality:method [B]
163782
public function end(...$args)
    {
        try {
            return ($this->wrapped)(...$args);
        } catch (\Throwable $e) {
            $class = get_class($e);
            if (isset($this->catchers[$class])) {
                return $this->handle($class, $args);
            } else {
                foreach ($this->parents as $parent => $check) {
                    if ($check && isset($this->catchers[$parent]) && is_subclass_of($e, $parent, false)) {
                        return $this->handle($parent, $args);
                    }
                }
            }
            throw $e;
        }
    }
95015
protected function processArguments($arguments) {
		$processedArgs = [];
		
		foreach ($arguments as $key => $argument) {
			if (! isset($argument->type)) {
				throw new Exceptions\InvalidConfig('Argument definition must contain a "type" property"');
			}
			
			$type = strtolower(trim($argument->type));
			
			if ($type === 'value') {
				$processedArgs[$key] = $this->processArgumentValue($argument);
				continue;
			}
			
			if ($type === 'service') {
				$processedArgs[$key] = $this->processArgumentService($argument);
				continue;
			}
			
			if ($type === 'parameter') {
				$processedArgs[$key] = $this->processArgumentParameter($argument);
				continue;
			}
			
			throw new Exceptions\InvalidConfig('Unknown type of argument: "' . $type . '"');
		}
		
		return $processedArgs;
	}
1262910
public function url( array $args = [] ) {
		$url = $this->siteurl;
		if ( $args ) {
			$url = add_query_arg( $args, $url );
		}

		return $url;
	}
859983
protected function processArguments($arguments)
    {
        if (false === is_array($arguments)) {
            return $arguments;
        }

        return array_map(function ($argument) {
            return (string) $argument;
        }, $arguments);
    }
1236845
public function input($arg,...$args){
        /** $args != null */
        if($args) {
            if(is_array($args[0])) {
                //$this->input('get',['name','pass']);
                $args = [$arg,$args[0]];
            }
            else {
                //$this->input('name','pass');
                array_unshift($args,$arg);
                $args = [$this->method,$args];
            }
        }
        else {
            /** $args == null */
            //$this->input('name');
            //$this->input(['name','pass']);
            $args = [$this->method,$arg];
        }

        $input = call_user_func_array([$this,'form'],$args);

        if(is_array($input) === false) {
            return null;
        }

        if(count($input) == 1) {
            return current($input);
        }

        return array_values($input);
    }
510431
public function declareOrder(array $args = array()) {
        $args = $this->getDeclareOrder()->parameters($this->merge($args))->text();
        if ($args['return_code'] != 'SUCCESS') {
            throw new Exception($args['return_msg']);
        }
        if (!$this->verify($args)) {
            throw new Exception(
                __('verify sign error')
            );
        }
        $this->set($args);
        return $args;
    }
307858
public static function instance( $args = array() ) {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self( $args );
		}

		return self::$instance;
	}
1199219
public static function prepareCommand(array $args)
    {
        $return = '*' . \count($args) . "\r\n";
        foreach ($args as $arg) {
            $return .= '$' . \strlen($arg) . "\r\n" . $arg . "\r\n";
        }

        return $return;
    }
28492
public function encode(array $args)
    {
        if (!$args) {
            return $args;
        }

        $serializable = [];

        foreach ($args as $arg) {
            $serializable[] = $this->serialize($arg);
        }

        return $serializable;
    }
100907
private function resolveArgs(array $args)
    {
        $resolved = [];
        foreach ($args as $argDefinition) {
            switch ($argDefinition['type']) {
                case 'lookup':
                    $resolved[] = $this->lookupRecursive($argDefinition['item']);
                    break;
                case 'value':
                    $resolved[] = $argDefinition['item'];
                    break;
            }
        }

        return $resolved;
    }
210895
private static function formatArgsForExpression(array $args)
    {
        $mapping = [];
        foreach ($args as $name => $config) {
            $mapping[] = \sprintf('%s: "%s"', $name, $config['type']);
        }

        return \sprintf('arguments({%s}, args)', \implode(', ', $mapping));
    }
58847
protected function normalizeArgs(array $args)
    {
        $error = $this->app->make('helper/validation/error');
        $normalized = [
            'askNewTeamCID' => null,
            'askNewTeamLink' => '',
        ];

        switch (isset($args['askNewTeamLinkType']) ? $args['askNewTeamLinkType'] : '') {
            case 'cid':
                if (isset($args['askNewTeamCID']) && ((is_string($args['askNewTeamCID']) && is_numeric($args['askNewTeamCID'])) || is_int($args['askNewTeamCID']))) {
                    $i = (int) $args['askNewTeamCID'];
                    if ($i > 0) {
                        $normalized['askNewTeamCID'] = $i;
                    }
                }
                break;
            case 'link':
                if (isset($args['askNewTeamLink']) && is_string($args['askNewTeamLink'])) {
                    $normalized['askNewTeamLink'] = trim($args['askNewTeamLink']);
                }
                break;
            }

        return $error->has() ? $error : $normalized;
    }
533259
public function parseArguments(array $args)
    {
        $this->action = null;
        $this->arguments = array();
        $parsed = array();
        $argument = reset($args);
        while ($argument) {
            if (strpos($argument, '=') > 0) {
                $arg = explode('=', $argument);
                $argKey = ltrim($arg[0], '-');
                $argValue = trim($arg[1], '"');
                $parsed[$argKey] = $argValue;
            } else {
                $parsed[ltrim($argument, '-')] = true;
            }
            $argument = next($args);
        }
        if (!isset($parsed['action']) || empty($parsed['action'])) {
            if (isset($parsed['version']) ||  isset($parsed['V'])) {
                $this->action = 'Version';
                $this->arguments = $parsed;
                return $this->arguments;
            }
            if (isset($parsed['help']) || isset($parsed['h'])) {
                $this->action = 'Help';
                $this->arguments = $parsed;
                return $this->arguments;
            }
            throw new RequestException($this, "No valid action argument specified.");
        }
        $this->action = $parsed['action'];
        unset($parsed['action']);
        $this->arguments = $parsed;
        return $this->arguments;
    }
789614
public function queryRefund(array $args = array()) {
        $args = $this->getQueryRefund()->parameters($this->merge($args))->text();
        if ($args['return_code'] != 'SUCCESS') {
            throw new Exception($args['return_msg']);
        }
        if (!$this->verify($args)) {
            throw new Exception('数据验签失败！');
        }
        return $args;
    }
1003222
public function group(array $args) {
        $groupedArgs = [
            'arguments' => [],
            'options' => [],
        ];

        $option = 'arguments';

        foreach ($args as $arg) {
            if ($this->isOptionNameOrAlias($arg)) {
                $option = $arg;

                if ( ! array_has($groupedArgs, $option)) {
                    $groupedArgs[$option] = [];
                    $groupedArgs['options'][$option] = 1;
                } else {
                    $groupedArgs['options'][$option] += 1;
                }
            } else {
                $groupedArgs[$option][] = $arg;
            }
        }

        return $groupedArgs;
    }
25801
public function _parse($args)
    {
        $this->_values = [];
        $this->_options = [];

        if (in_array(end($args), ['', '-', '--'], true)) {
            array_pop($args);
        }

        while ($args) {
            $o = array_shift($args);
            if ($o[0] !== '-') {
                $this->_values[] = $o;
                continue;
            }

            if (preg_match('#^-((\w)|-([\w-_]+))=(.*)$#', $o, $match)) {
                $this->_options[$match[2]] = $match[4];
                continue;
            }

            if ($o[1] === '-') {
                if (strlen($o) < 3) {
                    throw new ArgumentsException(['long `:option` option is too short', 'option' => $o]);
                }

                $this->_options[substr($o, 2)] = !$args || $args[0] === '-' ? 1 : array_shift($args);
            } elseif (strlen($o) > 2) {
                if (!$args || $args[0][0] === '-') {
                    /** @noinspection PhpParamsInspection */
                    foreach (str_split(substr($o, 1), 1) as $c) {
                        $this->_options[$c] = 1;
                    }
                } else {
                    $this->_options[substr($o, 1)] = array_shift($args);
                }
            } else {
                $this->_options[substr($o, 1)] = !$args || $args[0] === '-' ? 1 : array_shift($args);
            }
        }

        return $this;
    }
1242030
protected function parseArgs(string $arg)
    {
        if ($this->_lastVariadic) {
            return $this->set($this->_lastVariadic, $arg, true);
        }

        if (!$argument = \reset($this->_arguments)) {
            return $this->set(null, $arg);
        }

        $this->setValue($argument, $arg);

        // Otherwise we will always collect same arguments again!
        if (!$argument->variadic()) {
            \array_shift($this->_arguments);
        }
    }