   'phpDocumentor\Descriptor\FileDescriptor * hash 9782aefecde2b65ea2aa608fce417603 * pathConsole/Request.php	 * sourceq<?php
/**
 * MSF Console Request
 *
 * @author camera360_server@camera360.com
 * @copyright Chengdu pinguo Technology Co.,Ltd.
 */

namespace PG\MSF\Console;

/**
 * Class Request
 * @package PG\MSF\Console
 */
class Request
{
    /**
     * @var array 运行环境参数
     */
    public $server;

    /**
     * @var array 用于兼容和Web一样的方式获取参数
     */
    public $get;

    /**
     * @var array 用于兼容和Web一样的方式获取参数
     */
    public $post;

    /**
     * @var array 用于兼容和Web一样的方式获取参数
     */
    public $header;

    /**
     * 获取服务器相关变量（兼容Web模式）
     *
     * @return array|null
     */
    public function getServer()
    {
        if ($this->server === null) {
            if (isset($_SERVER['argv'])) {
                $this->server = $_SERVER['argv'];
                array_shift($this->server);
            } else {
                $this->server = [];
            }
        }

        return $this->server;
    }

    /**
     * 设置服务器相关变量（兼容Web模式）
     *
     * @param array $params 参数列表
     * @return $this
     */
    public function setServer($params)
    {
        $this->server = $params;
        return $this;
    }

    /**
     * 解析命令行参数
     *
     * @return array
     */
    public function resolve()
    {
        $rawParams = $this->getServer();
        if (isset($rawParams[0])) {
            $route = $rawParams[0];
            array_shift($rawParams);
        } else {
            $route = '';
        }

        $params = [];
        foreach ($rawParams as $param) {
            if (preg_match('/^--(\w+)(?:=(.*))?$/', $param, $matches) || preg_match('/^-(\w+)(?:=(.*))?$/', $param, $matches)) {
                $name = $matches[1];
                $params[$name] = isset($matches[2]) ? $matches[2] : true;
            } else {
                $params[] = $param;
            }
        }

        $this->server['path_info'] = $route;
        $this->get                 = $params;
        $this->post                = $params;

        return [$route, $params];
    }
}
 * namespaceAliases#phpDocumentor\Descriptor\Collection * items  * includes	  * constants	  * functions	 
 * classes	\PG\MSF\Console\Request(phpDocumentor\Descriptor\ClassDescriptor	 * parent * implements	  * abstract * final	  * properties	server+phpDocumentor\Descriptor\PropertyDescriptor" * types 
 * default 	 * static * visibilitypublic * fqsen\PG\MSF\Console\Request::server * name * namespace 
 * package
 * summary * description * fileDescriptor  * line * tags	var	 *phpDocumentor\Descriptor\Tag\VarDescriptor * variableName	 3phpDocumentor\Descriptor\Type\UnknownTypeDescriptorarray&"运行环境参数	 * errors	 ,	  * inheritedElement get"  \PG\MSF\Console\Request::get.  !"# $%	&	 '(	 )*&"-用于兼容和Web一样的方式获取参数,	 ,	 - post"  \PG\MSF\Console\Request::post1  !"# $%	&	 '(	 )*&"0,	 ,	 - header"  \PG\MSF\Console\Request::header3  !"# $#%	&	 '(	 )*&"0,	 ,	 - 
 * methods		getServer)phpDocumentor\Descriptor\MethodDescriptor" * arguments	 $\PG\MSF\Console\Request::getServer()6  !0获取服务器相关变量（兼容Web模式）"# $*%	return	 -phpDocumentor\Descriptor\Tag\ReturnDescriptor	 )*)null;",	 param	 ,	 - 	setServer7"8	$params+phpDocumentor\Descriptor\ArgumentDescriptor	 * method"Z	 )*  * byReference * isVariadic@  !"参数列表# $ %	 ,	 - $\PG\MSF\Console\Request::setServer()?  !0设置服务器相关变量（兼容Web模式）"# $>%	>	 ,phpDocumentor\Descriptor\Tag\ParamDescriptor(@"^>"E,	 ;	 <	 )$this;",	 ,	 - resolve7"8	 "\PG\MSF\Console\Request::resolve()J  !解析命令行参数"# $I%	;	 <	 )*;",	 >	 ,	 -  * usedTraits	 Request\PG\MSF\Console PG\MSF\Console!Class Request"#" $%	package	 &phpDocumentor\Descriptor\TagDescriptorR"P,	 
subpackage	 ,	 -  * interfaces	 	 * traits	 
 * markers	 Request.php  Default!MSF Console Request"# $ %	author	 -phpDocumentor\Descriptor\Tag\AuthorDescriptor["camera360_server@camera360.com,	 	copyright	 S^""Chengdu pinguo Technology Co.,Ltd.,	 R	 SR"Y,	 T	 ,	 - 