class Request in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/http-foundation/Request.php \Symfony\Component\HttpFoundation\Request
- 8 vendor/symfony/browser-kit/Request.php \Symfony\Component\BrowserKit\Request
- 8 vendor/zendframework/zend-diactoros/src/Request.php \Zend\Diactoros\Request
- 8 vendor/zendframework/zend-stdlib/src/Request.php \Zend\Stdlib\Request
- 8 vendor/guzzlehttp/psr7/src/Request.php \GuzzleHttp\Psr7\Request
- 8 vendor/jcalderonzumba/gastonjs/src/NetworkTraffic/Request.php \Zumba\GastonJS\NetworkTraffic\Request
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-diactoros/src/Request.php \Zend\Diactoros\Request
HTTP Request encapsulation
Requests are considered immutable; all methods that might change state are implemented such that they retain the internal state of the current message and return a new instance that contains the changed state.
Hierarchy
- class \Zend\Diactoros\Request implements RequestInterface uses MessageTrait
Expanded class hierarchy of Request
1 file declares its use of Request
- Serializer.php in vendor/
zendframework/ zend-diactoros/ src/ Request/ Serializer.php
3 string references to 'Request'
- legacy-services6.yml in vendor/
symfony/ dependency-injection/ Tests/ Fixtures/ yaml/ legacy-services6.yml - vendor/symfony/dependency-injection/Tests/Fixtures/yaml/legacy-services6.yml
- services20.yml in vendor/
symfony/ dependency-injection/ Tests/ Fixtures/ yaml/ services20.yml - vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services20.yml
- services9.yml in vendor/
symfony/ dependency-injection/ Tests/ Fixtures/ yaml/ services9.yml - vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services9.yml
File
- vendor/
zendframework/ zend-diactoros/ src/ Request.php, line 22
Namespace
Zend\DiactorosView source
class Request implements RequestInterface {
use MessageTrait, RequestTrait;
/**
* @param null|string $uri URI for the request, if any.
* @param null|string $method HTTP method for the request, if any.
* @param string|resource|StreamInterface $body Message body, if any.
* @param array $headers Headers for the message, if any.
* @throws \InvalidArgumentException for any invalid value.
*/
public function __construct($uri = null, $method = null, $body = 'php://temp', array $headers = []) {
$this
->initialize($uri, $method, $body, $headers);
}
/**
* {@inheritdoc}
*/
public function getHeaders() {
$headers = $this->headers;
if (!$this
->hasHeader('host') && ($this->uri && $this->uri
->getHost())) {
$headers['Host'] = [
$this
->getHostFromUri(),
];
}
return $headers;
}
/**
* {@inheritdoc}
*/
public function getHeader($header) {
if (!$this
->hasHeader($header)) {
if (strtolower($header) === 'host' && ($this->uri && $this->uri
->getHost())) {
return [
$this
->getHostFromUri(),
];
}
return [];
}
$header = $this->headerNames[strtolower($header)];
$value = $this->headers[$header];
$value = is_array($value) ? $value : [
$value,
];
return $value;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MessageTrait:: |
protected | property | Map of normalized header name to original name used to register header. | |
MessageTrait:: |
protected | property | List of all registered headers, as key => array of values. | |
MessageTrait:: |
private | property | ||
MessageTrait:: |
private | property | ||
MessageTrait:: |
private | function | Test that an array contains only strings | |
MessageTrait:: |
private static | function | Assert that the provided header values are valid. | |
MessageTrait:: |
private | function | Filter a set of headers to ensure they are in the correct internal format. | |
MessageTrait:: |
private static | function | Test if a value is a string | |
MessageTrait:: |
public | function | Gets the body of the message. | |
MessageTrait:: |
public | function | Retrieves a comma-separated string of the values for a single header. | |
MessageTrait:: |
public | function | Retrieves the HTTP protocol version as a string. | |
MessageTrait:: |
public | function | Checks if a header exists by the given case-insensitive name. | |
MessageTrait:: |
public | function | Return an instance with the specified header appended with the given value. | |
MessageTrait:: |
public | function | Return an instance with the specified message body. | |
MessageTrait:: |
public | function | Return an instance with the provided header, replacing any existing values of any headers with the same case-insensitive name. | |
MessageTrait:: |
public | function | Return an instance without the specified header. | |
MessageTrait:: |
public | function | Return an instance with the specified HTTP protocol version. | |
Request:: |
public | function |
Retrieves a message header value by the given case-insensitive name. Overrides MessageTrait:: |
|
Request:: |
public | function |
Retrieves all message headers. Overrides MessageTrait:: |
|
Request:: |
public | function | ||
RequestInterface:: |
public | function | Retrieves the HTTP method of the request. | 3 |
RequestInterface:: |
public | function | Retrieves the message's request target. | 2 |
RequestInterface:: |
public | function | Retrieves the URI instance. | 2 |
RequestInterface:: |
public | function | Return an instance with the provided HTTP method. | 3 |
RequestInterface:: |
public | function | Return an instance with the specific request-target. | 2 |
RequestInterface:: |
public | function | Returns an instance with the provided URI. | 2 |