class CliRequest
@internal
Hierarchy
- class \Symfony\Component\HttpFoundation\Request
- class \Symfony\Component\Console\Debug\CliRequest extends \Symfony\Component\HttpFoundation\Request
Expanded class hierarchy of CliRequest
1 file declares its use of CliRequest
- CommandDataCollector.php in vendor/
symfony/ console/ DataCollector/ CommandDataCollector.php
File
-
vendor/
symfony/ console/ Debug/ CliRequest.php, line 21
Namespace
Symfony\Component\Console\DebugView source
final class CliRequest extends Request {
public function __construct(TraceableCommand $command) {
parent::__construct(attributes: [
'_controller' => \get_class($command->command),
'_virtual_type' => 'command',
], server: $_SERVER);
}
// Methods below allow to populate a profile, thus enable search and filtering
public function getUri() : string {
if ($this->server
->has('SYMFONY_CLI_BINARY_NAME')) {
$binary = $this->server
->get('SYMFONY_CLI_BINARY_NAME') . ' console';
}
else {
$binary = $this->server
->get('argv')[0];
}
return $binary . ' ' . $this->command->input;
}
public function getMethod() : string {
return $this->command->isInteractive ? 'INTERACTIVE' : 'BATCH';
}
public function getResponse() : Response {
return new class ($this->command->exitCode) extends Response {
public function __construct(int $exitCode) {
parent::__construct();
}
public function getStatusCode() : int {
return $this->exitCode;
}
};
}
public function getClientIp() : string {
$application = $this->command
->getApplication();
return $application->getName() . ' ' . $application->getVersion();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
CliRequest::getClientIp | public | function | Returns the client IP address. | Overrides Request::getClientIp |
CliRequest::getMethod | public | function | Gets the request "intended" method. | Overrides Request::getMethod |
CliRequest::getResponse | public | function | ||
CliRequest::getUri | public | function | Generates a normalized URI (URL) for the Request. | Overrides Request::getUri |
CliRequest::__construct | public | function | Overrides Request::__construct | |
Request::$acceptableContentTypes | protected | property | ||
Request::$attributes | public | property | Custom parameters. | |
Request::$basePath | protected | property | ||
Request::$baseUrl | protected | property | ||
Request::$charsets | protected | property | ||
Request::$content | protected | property | ||
Request::$cookies | public | property | Cookies ($_COOKIE). | |
Request::$defaultLocale | protected | property | ||
Request::$encodings | protected | property | ||
Request::$files | public | property | Uploaded files ($_FILES). | |
Request::$format | protected | property | ||
Request::$formats | protected static | property | ||
Request::$headers | public | property | Headers (taken from the $_SERVER). | |
Request::$httpMethodParameterOverride | protected static | property | ||
Request::$isForwardedValid | private | property | ||
Request::$isHostValid | private | property | ||
Request::$isIisRewrite | private | property | ||
Request::$isSafeContentPreferred | private | property | ||
Request::$languages | protected | property | ||
Request::$locale | protected | property | ||
Request::$method | protected | property | ||
Request::$pathInfo | protected | property | ||
Request::$preferredFormat | private | property | ||
Request::$query | public | property | Query string parameters ($_GET). | |
Request::$request | public | property | Request body parameters ($_POST). | |
Request::$requestFactory | protected static | property | ||
Request::$requestUri | protected | property | ||
Request::$server | public | property | Server and execution environment parameters ($_SERVER). | |
Request::$session | protected | property | ||
Request::$trustedHeaderSet | private static | property | ||
Request::$trustedHostPatterns | protected static | property | ||
Request::$trustedHosts | protected static | property | ||
Request::$trustedProxies | protected static | property | ||
Request::$trustedValuesCache | private | property | ||
Request::create | public static | function | Creates a Request based on a given URI and configuration. | |
Request::createFromGlobals | public static | function | Creates a new request with values from PHP's super globals. | |
Request::createRequestFromFactory | private static | function | ||
Request::duplicate | public | function | Clones a request and overrides some of its parameters. | |
Request::enableHttpMethodParameterOverride | public static | function | Enables support for the _method request parameter to determine the intended HTTP method. | |
Request::formatLocale | private static | function | Strips the locale to only keep the canonicalized language value. | |
Request::FORWARDED_PARAMS | private | constant | ||
Request::get | public | function | Gets a "parameter" value from any bag. | |
Request::getAcceptableContentTypes | public | function | Gets a list of content types acceptable by the client browser in preferable order. | |
Request::getBasePath | public | function | Returns the root path from which this request is executed. | |
Request::getBaseUrl | public | function | Returns the root URL from which this request is executed. | |
Request::getBaseUrlReal | private | function | Returns the real base URL received by the webserver from which this request is executed. The URL does not include trusted reverse proxy prefix. |
|
Request::getCharsets | public | function | Gets a list of charsets acceptable by the client browser in preferable order. | |
Request::getClientIps | public | function | Returns the client IP addresses. | |
Request::getContent | public | function | Returns the request body content. | |
Request::getContentTypeFormat | public | function | Gets the usual name of the format associated with the request's media type (provided in the Content-Type header). | |
Request::getDefaultLocale | public | function | Get the default locale. | |
Request::getEncodings | public | function | Gets a list of encodings acceptable by the client browser in preferable order. | |
Request::getETags | public | function | Gets the Etags. | |
Request::getFormat | public | function | Gets the format associated with the mime type. | |
Request::getHost | public | function | Returns the host name. | |
Request::getHttpHost | public | function | Returns the HTTP host being requested. | |
Request::getHttpMethodParameterOverride | public static | function | Checks whether support for the _method request parameter is enabled. | |
Request::getLanguageCombinations | private static | function | Returns an array of all possible combinations of the language components. | |
Request::getLanguageComponents | private static | function | Returns an array with the language components of the locale. | |
Request::getLanguages | public | function | Gets a list of languages acceptable by the client browser ordered in the user browser preferences. | |
Request::getLocale | public | function | Get the locale. | |
Request::getMimeType | public | function | Gets the mime type associated with the format. | |
Request::getMimeTypes | public static | function | Gets the mime types associated with the format. | |
Request::getPassword | public | function | Returns the password. | |
Request::getPathInfo | public | function | Returns the path being requested relative to the executed script. | |
Request::getPayload | public | function | Gets the decoded form or json request body. | |
Request::getPort | public | function | Returns the port on which the request is made. | |
Request::getPreferredFormat | public | function | Gets the preferred format for the response by inspecting, in the following order: | |
Request::getPreferredLanguage | public | function | Returns the preferred language. | |
Request::getProtocolVersion | public | function | Returns the protocol version. | |
Request::getQueryString | public | function | Generates the normalized query string for the Request. | |
Request::getRealMethod | public | function | Gets the "real" request method. | |
Request::getRelativeUriForPath | public | function | Returns the path as relative reference from the current Request path. | |
Request::getRequestFormat | public | function | Gets the request format. | |
Request::getRequestUri | public | function | Returns the requested URI (path and query string). | |
Request::getScheme | public | function | Gets the request's scheme. | |
Request::getSchemeAndHttpHost | public | function | Gets the scheme and HTTP host. | |
Request::getScriptName | public | function | Returns current script name. | |
Request::getSession | public | function | Gets the Session. | |
Request::getTrustedHeaderSet | public static | function | Gets the set of trusted headers from trusted proxies. | |
Request::getTrustedHosts | public static | function | Gets the list of trusted host patterns. | |
Request::getTrustedProxies | public static | function | Gets the list of trusted proxies. | |
Request::getTrustedValues | private | function | This method is rather heavy because it splits and merges headers, and it's called by many other methods such as getPort(), isSecure(), getHost(), getClientIps(), getBaseUrl() etc. Thus, we try to cache the results for best performance. |
|
Request::getUriForPath | public | function | Generates a normalized URI for the given path. | |
Request::getUrlencodedPrefix | private | function | Returns the prefix as encoded in the string when the string starts with the given prefix, null otherwise. |
|
Request::getUser | public | function | Returns the user. | |
Request::getUserInfo | public | function | Gets the user info. | |
Request::hasPreviousSession | public | function | Whether the request contains a Session which was started in one of the previous requests. |
|
Request::hasSession | public | function | Whether the request contains a Session object. | |
Request::HEADER_FORWARDED | public | constant | ||
Request::HEADER_X_FORWARDED_AWS_ELB | public | constant | ||
Request::HEADER_X_FORWARDED_FOR | public | constant | ||
Request::HEADER_X_FORWARDED_HOST | public | constant | ||
Request::HEADER_X_FORWARDED_PORT | public | constant | ||
Request::HEADER_X_FORWARDED_PREFIX | public | constant | ||
Request::HEADER_X_FORWARDED_PROTO | public | constant | ||
Request::HEADER_X_FORWARDED_TRAEFIK | public | constant | ||
Request::initialize | public | function | Sets the parameters for this request. | |
Request::initializeFormats | protected static | function | Initializes HTTP request formats. | |
Request::isFromTrustedProxy | public | function | Indicates whether this request originated from a trusted proxy. | |
Request::isIisRewrite | private | function | Is this IIS with UrlRewriteModule? | |
Request::isMethod | public | function | Checks if the request method is of specified type. | |
Request::isMethodCacheable | public | function | Checks whether the method is cacheable or not. | |
Request::isMethodIdempotent | public | function | Checks whether or not the method is idempotent. | |
Request::isMethodSafe | public | function | Checks whether or not the method is safe. | |
Request::isNoCache | public | function | ||
Request::isSecure | public | function | Checks whether the request is secure or not. | |
Request::isXmlHttpRequest | public | function | Returns true if the request is an XMLHttpRequest. | |
Request::METHOD_CONNECT | public | constant | ||
Request::METHOD_DELETE | public | constant | ||
Request::METHOD_GET | public | constant | ||
Request::METHOD_HEAD | public | constant | ||
Request::METHOD_OPTIONS | public | constant | ||
Request::METHOD_PATCH | public | constant | ||
Request::METHOD_POST | public | constant | ||
Request::METHOD_PURGE | public | constant | ||
Request::METHOD_PUT | public | constant | ||
Request::METHOD_TRACE | public | constant | ||
Request::normalizeAndFilterClientIps | private | function | ||
Request::normalizeQueryString | public static | function | Normalizes a query string. | |
Request::overrideGlobals | public | function | Overrides the PHP global variables according to this request instance. | |
Request::preferSafeContent | public | function | Checks whether the client browser prefers safe content or not according to RFC8674. | |
Request::prepareBasePath | protected | function | Prepares the base path. | |
Request::prepareBaseUrl | protected | function | Prepares the base URL. | |
Request::preparePathInfo | protected | function | Prepares the path info. | |
Request::prepareRequestUri | protected | function | ||
Request::setDefaultLocale | public | function | Sets the default locale. | |
Request::setFactory | public static | function | Sets a callable able to create a Request instance. | |
Request::setFormat | public | function | Associates a format with mime types. | |
Request::setLocale | public | function | Sets the locale. | |
Request::setMethod | public | function | Sets the request method. | |
Request::setPhpDefaultLocale | private | function | ||
Request::setRequestFormat | public | function | Sets the request format. | |
Request::setSession | public | function | ||
Request::setSessionFactory | public | function | @internal | |
Request::setTrustedHosts | public static | function | Sets a list of trusted host patterns. | |
Request::setTrustedProxies | public static | function | Sets a list of trusted proxies. | |
Request::toArray | public | function | Gets the request body decoded as array, typically from a JSON payload. | |
Request::TRUSTED_HEADERS | private | constant | Names for headers that can be trusted when using trusted proxies. |
|
Request::__clone | public | function | Clones the current request. | |
Request::__toString | public | function |