   'phpDocumentor\Descriptor\FileDescriptor * hash 6d9c590536fc36f3abca33815d41fb80 * pathBase/Input.php	 * source_<?php
/**
 * 请求的输入对象（用于代替传统$_GET/$_POST/$_SERVER）
 *
 * @author camera360_server@camera360.com
 * @copyright Chengdu pinguo Technology Co.,Ltd.
 */

namespace PG\MSF\Base;

/**
 * Class Input
 * @package PG\MSF\Base
 */
class Input extends Core
{
    /**
     * @var \swoole_http_request|\PG\MSF\Console\Request 请求参数对象
     */
    public $request;

    /**
     * @var \swoole_http_request 用于自动序列化（解决序列化资源被析构的问题）
     */
    public $__serializeRequest;

    /**
     * 属性用于序列化
     *
     * @return array
     */
    public function __sleep()
    {
        $this->__serializeRequest          = new \swoole_http_request();
        $this->__serializeRequest->get     = $this->request->get  ?? [];
        $this->__serializeRequest->post    = $this->request->post ?? [];
        $this->__serializeRequest->files   = $this->request->files ?? [];
        $this->__serializeRequest->cookie  = $this->request->cookie ?? [];
        $this->__serializeRequest->header  = $this->request->header ?? [];
        $this->__serializeRequest->server  = $this->request->server ?? [];

        return ['__serializeRequest'];
    }

    /**
     * 反序列化后的初始化操作
     */
    public function __wakeup()
    {
        $this->request = $this->__serializeRequest;
    }

    /**
     * 设置请求参数对象
     *
     * @param \swoole_http_request|\PG\MSF\Console\Request $request 请求参数对象
     * @return $this
     */
    public function set($request)
    {
        $this->request = $request;
        return $this;
    }

    /**
     * 重置请求参数对象
     *
     * @return $this
     */
    public function reset()
    {
        unset($this->request);
        return $this;
    }

    /**
     * 获取POST/GET参数，优先读取POST
     *
     * @param string $index 请求参数名
     * @return string
     */
    public function postGet($index)
    {
        return $this->request->post[$index] ?? $this->get($index);
    }

    /**
     * 获取POST参数
     *
     * @param string $index POST参数名
     * @return string
     */
    public function post($index)
    {
        return $this->request->post[$index] ?? '';
    }

    /**
     * 获取GET参数
     *
     * @param string $index GET参数名
     * @return string
     */
    public function get($index)
    {
        return $this->request->get[$index] ?? '';
    }

    /**
     * 获取POST/GET参数，优先读取GET
     *
     * @param string $index 请求参数名
     * @return string
     */
    public function getPost($index)
    {
        return $this->request->get[$index] ?? $this->post($index);
    }

    /**
     * 先获取所有的POST参数，如果POST为空则获取所有的Get参数
     *
     * @return array
     */
    public function getAllPostGet()
    {
        return $this->request->post ?? $this->request->get ?? [];
    }

    /**
     * 获取所有的POST参数
     *
     * @return array
     */
    public function getAllPost()
    {
        return $this->request->post ?? [];
    }

    /**
     * 获取所有的GET参数
     *
     * @return array
     */
    public function getAllGet()
    {
        return $this->request->get ?? [];
    }


    /**
     * 获取请求的所有报头
     *
     * @return array
     */
    public function getAllHeader()
    {
        return $this->request->header ?? [];
    }

    /**
     * 获取处理请求的Server信息
     *
     * @return array
     */
    public function getAllServer()
    {
        return $this->request->server ?? [];
    }

    /**
     * 获取原始的POST包体
     *
     * @return string
     */
    public function getRawContent()
    {
        return $this->request->rawContent();
    }

    /**
     * 设置POST请求参数
     *
     * @param string $key 设置参数的key
     * @param mixed $value 设置参数的value
     * @return $this
     */
    public function setPost($key, $value)
    {
        $this->request->post[$key] = $value;
        return $this;
    }

    /**
     * 设置GET请求参数
     *
     * @param string $key 设置参数的key
     * @param mixed $value 设置参数的value
     * @return $this
     */
    public function setGet($key, $value)
    {
        $this->request->get[$key] = $value;
        return $this;
    }

    /**
     * 设置所有POST请求参数
     *
     * @param array $post 所有的待设置的POST请求参数
     * @return $this
     */
    public function setAllPost(array $post)
    {
        $this->request->post = $post;
        return $this;
    }

    /**
     * 设置所有GET请求参数
     *
     * @param array $get 所有的待设置的GET请求参数
     * @return $this
     */
    public function setAllGet(array $get)
    {
        $this->request->get = $get;
        return $this;
    }

    /**
     * 获取Cookie参数
     *
     * @param string $index Cookie参数名
     * @return string
     */
    public function getCookie($index)
    {
        return $this->request->cookie[$index] ?? '';
    }

    /**
     * 获取上传文件信息
     *
     * @param string $index File文件名
     * @return array
     */
    public function getFile($index)
    {
        return $this->request->files[$index] ?? '';
    }

    /**
     * 获取Server相关的数据
     *
     * @param string $index 获取的Server参数名
     * @return array|bool|string
     */
    public function getServer($index)
    {
        return $this->request->server[$index] ?? '';
    }

    /**
     * 获取请求的方法
     *
     * @return string
     */
    public function getRequestMethod()
    {
        if (isset($this->request->server['http_x_http_method_override'])) {
            return strtoupper($this->request->server['http_x_http_method_override']);
        }
        if (isset($this->request->server['request_method'])) {
            return strtoupper($this->request->server['request_method']);
        }

        return 'GET';
    }

    /**
     * 获取请求的URI
     *
     * @return string
     */
    public function getRequestUri()
    {
        return $this->request->server['request_uri'];
    }

    /**
     * 获取请求的PATH
     *
     * @return string
     */
    public function getPathInfo()
    {
        return $this->request->server['path_info'];
    }

    /**
     * 获取请求的用户ID
     *
     * @return string
     */
    public function getRemoteAddr()
    {
        if (($ip = $this->getHeader('x-forwarded-for')) || ($ip = $this->getHeader('http_x_forwarded_for'))
            || ($ip = $this->getHeader('http_forwarded')) || ($ip = $this->getHeader('http_forwarded_for'))
            || ($ip = $this->getHeader('http_forwarded'))
        ) {
            $ip = explode(',', $ip);
            $ip = trim($ip[0]);
        } elseif ($ip = $this->getHeader('http_client_ip')) {
        } elseif ($ip = $this->getHeader('x-real-ip')) {
        } elseif ($ip = $this->getHeader('remote_addr')) {
        } elseif ($ip = $this->request->server['remote_addr']) {
            // todo
        }

        return $ip;
    }

    /**
     * 获取请求报头参数
     *
     * @param string $index 请求报头参数名
     * @return string
     */
    public function getHeader($index)
    {
        return $this->request->header[$index] ?? '';
    }

    /**
     * 销毁,解除引用
     */
    public function destroy()
    {
        parent::destroy();
    }
}
 * namespaceAliases#phpDocumentor\Descriptor\Collection * items  * includes	  * constants	  * functions	 
 * classes	\PG\MSF\Base\Input(phpDocumentor\Descriptor\ClassDescriptor	 * parent\PG\MSF\Base\Core * implements	  * abstract * final	  * properties	request+phpDocumentor\Descriptor\PropertyDescriptor" * types 
 * default 	 * static * visibilitypublic * fqsen\PG\MSF\Base\Input::request * name * namespace 
 * package
 * summary * description * fileDescriptor  * line * tags	var	 *phpDocumentor\Descriptor\Tag\VarDescriptor * variableName	 3phpDocumentor\Descriptor\Type\UnknownTypeDescriptor\swoole_http_request*\PG\MSF\Console\Request'#请求参数对象	 * errors	 .	  * inheritedElement __serializeRequest"  &\PG\MSF\Base\Input::__serializeRequest0  !"#$ %&	'	 ()	 *+'#B用于自动序列化（解决序列化资源被析构的问题）.	 .	 / 
 * methods	__sleep)phpDocumentor\Descriptor\MethodDescriptor" * arguments	 \PG\MSF\Base\Input::__sleep()4  !"属性用于序列化#$ % &	return	 -phpDocumentor\Descriptor\Tag\ReturnDescriptor	 *array9#.	 param	 .	 / __wakeup5"6	 \PG\MSF\Base\Input::__wakeup()=  !"!反序列化后的初始化操作#$ %0&	9	 <	 .	 / set5"6	$request+phpDocumentor\Descriptor\ArgumentDescriptor	 * method"K	 *+*,  * byReference * isVariadicA  !"#-$ % &	 .	 / \PG\MSF\Base\Input::set()@  !"设置请求参数对象#$ %;&	<	 ,phpDocumentor\Descriptor\Tag\ParamDescriptor)A"O<#-.	 9	 :	 *$this9#.	 .	 / reset5"6	 \PG\MSF\Base\Input::reset()J  !"重置请求参数对象#$ %F&	9	 :	 *I9#.	 <	 .	 / postGet5"6	$indexBC"y	 .phpDocumentor\Descriptor\Type\StringDescriptor  DEN  !"#请求参数名$ % &	 .	 / \PG\MSF\Base\Input::postGet()M  !"'获取POST/GET参数，优先读取POST#$ %R&	<	 H)N"}<#P.	 9	 :	 O 9#.	 .	 / post5"6	NBC"	 O  DEN  !"#POST参数名$ % &	 .	 / \PG\MSF\Base\Input::post()S  !"获取POST参数#$ %]&	<	 H)N"<#T.	 9	 :	 O 9#.	 .	 / get5"6	NBC"	 O  DEN  !"#GET参数名$ % &	 .	 / \PG\MSF\Base\Input::get()W  !"获取GET参数#$ %h&	<	 H)N"<#X.	 9	 :	 O 9#.	 .	 / getPost5"6	NBC"	 O  DEN  !"#P$ % &	 .	 / \PG\MSF\Base\Input::getPost()[  !"&获取POST/GET参数，优先读取GET#$ %s&	<	 H)N"<#P.	 9	 :	 O 9#.	 .	 / getAllPostGet5"6	 #\PG\MSF\Base\Input::getAllPostGet()^  !"J先获取所有的POST参数，如果POST为空则获取所有的Get参数#$ %}&	9	 :	 *;9#.	 <	 .	 / 
getAllPost5"6	  \PG\MSF\Base\Input::getAllPost()a  !"获取所有的POST参数#$ %&	9	 :	 *;9#.	 <	 .	 / 	getAllGet5"6	 \PG\MSF\Base\Input::getAllGet()d  !"获取所有的GET参数#$ %&	9	 :	 *;9#.	 <	 .	 / getAllHeader5"6	 "\PG\MSF\Base\Input::getAllHeader()g  !"获取请求的所有报头#$ %&	9	 :	 *;9#.	 <	 .	 / getAllServer5"6	 "\PG\MSF\Base\Input::getAllServer()j  !"!获取处理请求的Server信息#$ %&	9	 :	 *;9#.	 <	 .	 / getRawContent5"6	 #\PG\MSF\Base\Input::getRawContent()m  !"获取原始的POST包体#$ %&	9	 :	 O 9#.	 <	 .	 / setPost5"6	$keyBC#O	 O  DEq  !"#设置参数的key$ % &	 .	 / $valueBC#O	 *mixed DEs  !"#设置参数的value$ % &	 .	 / \PG\MSF\Base\Input::setPost()p  !"设置POST请求参数#$ %&	<	 H)q#S<#r.	 H)s#[<#u.	 9	 :	 *I9#.	 .	 / setGet5"6	qBC#v	 O  DEq  !"#r$ % &	 .	 / sBC#v	 *t DEs  !"#u$ % &	 .	 / \PG\MSF\Base\Input::setGet()x  !"设置GET请求参数#$ %&	<	 H)q#z<#r.	 H)s#<#u.	 9	 :	 *I9#.	 .	 / 
setAllPost5"6	$postBC#	 *; DE|  !"#%所有的待设置的POST请求参数$ % &	 .	 /  \PG\MSF\Base\Input::setAllPost(){  !"设置所有POST请求参数#$ %&	<	 H)|#<#}.	 9	 :	 *I9#.	 .	 / 	setAllGet5"6	$getBC#	 *; DE  !"#$所有的待设置的GET请求参数$ % &	 .	 / \PG\MSF\Base\Input::setAllGet()  !"设置所有GET请求参数#$ %&	<	 H)#<#.	 9	 :	 *I9#.	 .	 / 	getCookie5"6	NBC#	 O  DEN  !"#Cookie参数名$ % &	 .	 / \PG\MSF\Base\Input::getCookie()  !"获取Cookie参数#$ %&	<	 H)N#<#.	 9	 :	 O 9#.	 .	 / getFile5"6	NBC#	 O  DEN  !"#File文件名$ % &	 .	 / \PG\MSF\Base\Input::getFile()  !"获取上传文件信息#$ %&	<	 H)N#<#.	 9	 :	 *;9#.	 .	 / 	getServer5"6	NBC#	 O  DEN  !"#获取的Server参数名$ % &	 .	 / \PG\MSF\Base\Input::getServer()  !"获取Server相关的数据#$ %&	<	 H)N#<#.	 9	 :	 *;/phpDocumentor\Descriptor\Type\BooleanDescriptor O 9#.	 .	 / getRequestMethod5"6	 &\PG\MSF\Base\Input::getRequestMethod()  !"获取请求的方法#$ %&	9	 :	 O 9#.	 <	 .	 / getRequestUri5"6	 #\PG\MSF\Base\Input::getRequestUri()  !"获取请求的URI#$ %&	9	 :	 O 9#.	 <	 .	 / getPathInfo5"6	 !\PG\MSF\Base\Input::getPathInfo()  !"获取请求的PATH#$ %(&	9	 :	 O 9#.	 <	 .	 / getRemoteAddr5"6	 #\PG\MSF\Base\Input::getRemoteAddr()  !"获取请求的用户ID#$ %2&	9	 :	 O 9#.	 <	 .	 / 	getHeader5"6	NBC#o	 O  DEN  !"#请求报头参数名$ % &	 .	 / \PG\MSF\Base\Input::getHeader()  !"获取请求报头参数#$ %J&	<	 H)N#s<#.	 9	 :	 O 9#.	 .	 / destroy5"6	 \PG\MSF\Base\Input::destroy()  !"销毁,解除引用#$ %R&	9	 <	 .	 /  * usedTraits	 Input \PG\MSF\Base!PG\MSF\Base"Class Input#$" %&	package	 &phpDocumentor\Descriptor\TagDescriptor#.	 
subpackage	 .	 /  * interfaces	 	 * traits	 
 * markers	 	Input.php  !Default"B请求的输入对象（用于代替传统$_GET/$_POST/$_SERVER）#$ % &	author	 -phpDocumentor\Descriptor\Tag\AuthorDescriptor#camera360_server@camera360.com.	 	copyright	 #"Chengdu pinguo Technology Co.,Ltd..	 	 #.	 	 .	 / 