protected function initCli () {
		$this->phpSapi = php_sapi_name();
		$phpSapiCHasCli = FALSE;
		if (substr($this->phpSapi, 0, 3) === 'cli') {
			$this->phpSapi = 'cli';
			$phpSapiCHasCli = TRUE;
		}
		$this->cli = FALSE;
		if ($phpSapiCHasCli && !isset($this->globalServer['REQUEST_URI'])) {
			$this->cli = TRUE;
			
			$hostName = gethostname();
			$this->scheme = 'file:';
			$this->secure = FALSE;
			$this->hostName = $hostName;
			$this->host = $hostName;
			$this->port = '';
			$this->path = '';
			$this->query = '';
			$this->fragment = '';
			$this->ajax = FALSE;

			$this->basePath = '';
			$this->requestPath = '';
			$this->domainUrl = '';
			$this->baseUrl = '';
			$this->requestUrl = '';
			$this->fullUrl = '';
			$this->referer = '';
			$this->serverIp = '127.0.0.1';
			$this->clientIp = $this->serverIp;
			$this->contentLength = 0;
			$this->headers = [];
			$this->params = [];
			$this->appRequest = FALSE;

			$this->method = 'GET';
			
			// sometimes `$_SERVER['SCRIPT_FILENAME']` is missing, when script 
			// is running in CLI or it could have relative path only
			$backtraceItems = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
			$indexFilePath = str_replace('\\', '/', $backtraceItems[count($backtraceItems) - 1]['file']);
			$lastSlashPos = mb_strrpos($indexFilePath, '/');

			$this->appRoot = mb_substr($indexFilePath, 0, $lastSlashPos);
			$this->scriptName = mb_substr($indexFilePath, $lastSlashPos);

			$args = $this->globalServer['argv'];
			array_shift($args);
			$params = [];
			if ($args) {
				foreach ($args as $arg) {
					parse_str($arg, $paramsLocal);
					if (!$paramsLocal) continue;
					foreach ($paramsLocal as $paramName => $paramValue) {
						if (is_array($paramValue)) {
							$params = array_merge(
								$params, 
								[$paramName => array_merge(
									$params[$paramName] ?: [], $paramValue
								)]
							);
						} else {
							$params[$paramName] = $paramValue;
						}
					}
				}
			}
			$this->params = $params;
			$this->globalGet = $params;
		}
	}
protected function initCli () {
		$this->phpSapi = php_sapi_name();
		$phpSapiCHasCli = FALSE;
		if (substr($this->phpSapi, 0, 3) === 'cli') {
			$this->phpSapi = 'cli';
			$phpSapiCHasCli = TRUE;
		}
		$this->cli = FALSE;
		if ($phpSapiCHasCli && !isset($this->globalServer['REQUEST_URI'])) {
			$this->cli = TRUE;
			
			$hostName = gethostname();
			$this->scheme = 'file:';
			$this->secure = FALSE;
			$this->hostName = $hostName;
			$this->host = $hostName;
			$this->port = '';
			$this->path = '';
			$this->query = '';
			$this->fragment = '';
			$this->ajax = FALSE;

			$this->basePath = '';
			$this->requestPath = '';
			$this->domainUrl = '';
			$this->baseUrl = '';
			$this->requestUrl = '';
			$this->fullUrl = '';
			$this->referer = '';
			$this->serverIp = '127.0.0.1';
			$this->clientIp = $this->serverIp;
			$this->contentLength = 0;
			$this->headers = [];
			$this->params = [];
			$this->appRequest = FALSE;

			$this->method = 'GET';
			
			// sometimes `$_SERVER['SCRIPT_FILENAME']` is missing, when script 
			// is running in CLI or it could have relative path only
			$backtraceItems = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
			$indexFilePath = str_replace('\\', '/', $backtraceItems[count($backtraceItems) - 1]['file']);
			$lastSlashPos = mb_strrpos($indexFilePath, '/');

			$this->appRoot = mb_substr($indexFilePath, 0, $lastSlashPos);
			$this->scriptName = mb_substr($indexFilePath, $lastSlashPos);

			$args = $this->globalServer['argv'];
			array_shift($args);
			$params = [];
			if ($args) {
				foreach ($args as $arg) {
					parse_str($arg, $paramsLocal);
					if (!$paramsLocal) continue;
					foreach ($paramsLocal as $paramName => $paramValue) {
						if (is_array($paramValue)) {
							$params = array_merge(
								$params, 
								[$paramName => array_merge(
									$params[$paramName] ?: [], $paramValue
								)]
							);
						} else {
							$params[$paramName] = $paramValue;
						}
					}
				}
			}
			$this->params = $params;
			$this->globalGet = $params;
		}
	}
protected function initCli ( ) { $ this -> phpSapi = php_sapi_name ( ) ; $ phpSapiCHasCli = FALSE ; if ( substr ( $ this -> phpSapi , 0 , 3 ) === 'cli' ) { $ this -> phpSapi = 'cli' ; $ phpSapiCHasCli = TRUE ; } $ this -> cli = FALSE ; if ( $ phpSapiCHasCli && ! isset ( $ this -> globalServer [ 'REQUEST_URI' ] ) ) { $ this -> cli = TRUE ; $ hostName = gethostname ( ) ; $ this -> scheme = 'file:' ; $ this -> secure = FALSE ; $ this -> hostName = $ hostName ; $ this -> host = $ hostName ; $ this -> port = '' ; $ this -> path = '' ; $ this -> query = '' ; $ this -> fragment = '' ; $ this -> ajax = FALSE ; $ this -> basePath = '' ; $ this -> requestPath = '' ; $ this -> domainUrl = '' ; $ this -> baseUrl = '' ; $ this -> requestUrl = '' ; $ this -> fullUrl = '' ; $ this -> referer = '' ; $ this -> serverIp = '127.0.0.1' ; $ this -> clientIp = $ this -> serverIp ; $ this -> contentLength = 0 ; $ this -> headers = [ ] ; $ this -> params = [ ] ; $ this -> appRequest = FALSE ; $ this -> method = 'GET' ; // sometimes `$_SERVER['SCRIPT_FILENAME']` is missing, when script  // is running in CLI or it could have relative path only $ backtraceItems = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS ) ; $ indexFilePath = str_replace ( '\\' , '/' , $ backtraceItems [ count ( $ backtraceItems ) - 1 ] [ 'file' ] ) ; $ lastSlashPos = mb_strrpos ( $ indexFilePath , '/' ) ; $ this -> appRoot = mb_substr ( $ indexFilePath , 0 , $ lastSlashPos ) ; $ this -> scriptName = mb_substr ( $ indexFilePath , $ lastSlashPos ) ; $ args = $ this -> globalServer [ 'argv' ] ; array_shift ( $ args ) ; $ params = [ ] ; if ( $ args ) { foreach ( $ args as $ arg ) { parse_str ( $ arg , $ paramsLocal ) ; if ( ! $ paramsLocal ) continue ; foreach ( $ paramsLocal as $ paramName => $ paramValue ) { if ( is_array ( $ paramValue ) ) { $ params = array_merge ( $ params , [ $ paramName => array_merge ( $ params [ $ paramName ] ? : [ ] , $ paramValue ) ] ) ; } else { $ params [ $ paramName ] = $ paramValue ; } } } } $ this -> params = $ params ; $ this -> globalGet = $ params ; } }
If request is processed via CLI, initialize most of request properties
with empty values and parse CLI params into params array.
@return void
If request is processed via CLI initialize most of request properties with empty values and parse CLI params into params array .