Builds the cli request object

@access protected
@return \Zepi\Turbo\Request\CliRequest
353305
protected function buildCliRequest()
    {
        global $argv;
        
        $args = $argv;
        $params = array();
        $route = '';
        
        foreach ($args as $arg) {
            if ($arg === $_SERVER['PHP_SELF']) {
                continue;
            }
            
            if (strpos($arg, '-') === 0) {
                list($key, $value) = $this->parseArgument($arg);
                
                $params[$key] = $value;
            } else {
                if ($route !== '') {
                    $route .= ' ';
                }
                
                $route .= $arg;
            }
        }
        
        $base = $argv[0];
        
        $operatingSystem = $this->getOperatingSystem();
        
        return new CliRequest($route, $params, $base, 'en_US', $operatingSystem);
    }
496629
public function resourceRequires()
    {
        $this->requiredTypes = array_merge(func_get_args(), $this->requiredTypes);
        $this->canServerSupportThisRequest();

        return $this;
    }
973904
public function build(): StartPreciseCoverageRequest
	{
		$instance = new StartPreciseCoverageRequest();
		$instance->callCount = $this->callCount;
		$instance->detailed = $this->detailed;
		return $instance;
	}
1199713
public function buildClient()
    {
        //Handle redirect configuration for guzzle 6
        if (class_exists('\GuzzleHttp\Psr7\Request')) {
            $options = ['allow_redirects' => false];
        } else {
            $options = [
                'defaults' => [
                    'allow_redirects' => false
                ]
            ];
        }

        $this->client = new Client(
            $options
        );
    }
186984
public function exec() {
		list($query, $args) = $this->build();
		if (empty($this->config))
			return call_user_func([$this->fluent->getMapper(), 'sql'], $query, $args);
		return call_user_func([$this->fluent->getMapper()->merge($this->config), 'sql'], $query, $args);
	}
185899
public function build(): GetContentQuadsRequest
	{
		$instance = new GetContentQuadsRequest();
		$instance->nodeId = $this->nodeId;
		$instance->backendNodeId = $this->backendNodeId;
		$instance->objectId = $this->objectId;
		return $instance;
	}
952567
protected function prepareMethodName()
    {
        if (PHP_SAPI === 'cli') {
            $method = 'cli';
        } else {
            /** @var Request $request */
            $request = $this->getContainer()->get('request');
            $method = $request->getMethod();
        }

        return ucfirst(strtolower($method)) . 'Method';
    }
281206
public function call() {
        $request = $this->createRequest();
        $response = $this->api->execute($request, $this);
        $this->response = $response;

        if ($this->shouldResponseBeProcessed($response)) {
            $instance = \GithubService\Model\OauthAccess::createFromResponse($response, $this);

            return $instance;
        }
        return $response;
    }
278558
protected function buildPluginRequest()
    {
        /** @var $parentRequest ActionRequest */
        $parentRequest = $this->runtime->getControllerContext()->getRequest();
        $pluginRequest = new ActionRequest($parentRequest);
        $pluginRequest->setArgumentNamespace('--' . $this->getPluginNamespace());
        $this->passArgumentsToPluginRequest($pluginRequest);

        if ($this->node instanceof NodeInterface) {
            $pluginRequest->setArgument('__node', $this->node);
            if ($pluginRequest->getControllerPackageKey() === null) {
                $pluginRequest->setControllerPackageKey($this->node->getProperty('package') ?: $this->getPackage());
            }
            if ($pluginRequest->getControllerSubpackageKey() === null) {
                $pluginRequest->setControllerSubpackageKey($this->node->getProperty('subpackage') ?: $this->getSubpackage());
            }
            if ($pluginRequest->getControllerName() === null) {
                $pluginRequest->setControllerName($this->node->getProperty('controller') ?: $this->getController());
            }
            if ($pluginRequest->getControllerActionName() === null) {
                $actionName = $this->node->getProperty('action');
                if ($actionName === null || $actionName === '') {
                    $actionName = $this->getAction() !== null ? $this->getAction() : 'index';
                }
                $pluginRequest->setControllerActionName($actionName);
            }

            $pluginRequest->setArgument('__node', $this->node);
            $pluginRequest->setArgument('__documentNode', $this->documentNode);
        } else {
            $pluginRequest->setControllerPackageKey($this->getPackage());
            $pluginRequest->setControllerSubpackageKey($this->getSubpackage());
            $pluginRequest->setControllerName($this->getController());
            $pluginRequest->setControllerActionName($this->getAction());
        }

        foreach ($this->properties as $key => $value) {
            $pluginRequest->setArgument('__' . $key, $this->fusionValue($key));
        }
        return $pluginRequest;
    }
1114085
public static function build()
    {
        $ini = eZINI::instance( 'file.ini' );
        $defaultHandler = eZDFSFileHandlerBackendFactory::buildHandler(
            $ini->variable( 'DispatchableDFS', 'DefaultBackend' )
        );

        $pathHandlers = array();
        foreach ( $ini->variable( 'DispatchableDFS', 'PathBackends' ) as $supportedPath => $backendClass )
        {
            // @todo Make it possible to use a Symfony2 service
            $pathHandlers[$supportedPath] = eZDFSFileHandlerBackendFactory::buildHandler( $backendClass );
        }

        return new static( $defaultHandler, $pathHandlers );
    }
583828
static public function cli()
	{
	    $key = 'app.cli';
	    
	    if (!static::has($key)) {
	        if ( !($app = static::app()) || !$app->isCli()) {
	            static::setShared($key, new \Wslim\Console\App(Config::getCliAppPath()));
	        }
	    }
	    
	    return static::get($key);
	}
1031579
protected function build() {
		$args = $this->getApiCommand()->getParams();
		foreach($args as $arg) {
			if($arg->getLocation() && $arg->getLocation() == 'path') {
				$this->_disposable_parameters += array($arg->getName() => null);
			}
		}
		
		$remainder = array_diff_key($this->getAll(), $this->_disposable_parameters);
    // TODO: Maybe limit this to only params which are defined in the *.xml file?
    // Maybe with an overridable "strict" mode?

    $this->getClient()->decorateRequest(
      $this->get('method'),
      $this->get('path'),
      $remainder,
      $this->request
    );
	}
104650
public function build(): SetInspectModeRequest
	{
		$instance = new SetInspectModeRequest();
		if ($this->mode === null) {
			throw new BuilderException('Property [mode] is required.');
		}
		$instance->mode = $this->mode;
		$instance->highlightConfig = $this->highlightConfig;
		return $instance;
	}
1012567
public function build(): CloseRequest
	{
		$instance = new CloseRequest();
		if ($this->handle === null) {
			throw new BuilderException('Property [handle] is required.');
		}
		$instance->handle = $this->handle;
		return $instance;
	}
1320252
private function cliIO()
    {
        $services = [
            'Cli\Input'  => 'input',
            'Cli\Output' => 'output',
        ];

        foreach ($services as $className => $classOffset) {
            $this->services->load($className, $classOffset);
        }
    }
846229
protected function getRequest()
    {
        global $argc, $argv, $args;

        if (php_sapi_name() == 'cli') {
            return trim('CLI ' . (isset($argv[1]) ? $argv[1] : ''));
        } else {
            return (empty($_SERVER['REQUEST_METHOD']) ? 'GET' : $_SERVER['REQUEST_METHOD']) . ' ' . $this->getPath();
        }
    }
397247
protected function buildGlobalEnvironment()
    {
        $request = clone $this;
        
        $request->serverParams =& $_SERVER;
        $request->cookies =& $_COOKIE;
        $request->queryParams =& $_GET;
        
        $request->setPostData($_POST);
        $request->setUploadedFiles($_FILES);
        
        $request->body = Stream::open('php://input', 'r');
        
        $request->reset();
        
        $request->isStale = false;
        
        return $request;
    }