Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

SimplifiedRequest.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\MVC\Symfony\Routing;
8
9 use eZ\Publish\API\Repository\Values\ValueObject;
10
20 class SimplifiedRequest extends ValueObject
21 {
27 protected $scheme;
28
34 protected $host;
35
41 protected $port;
42
49 protected $pathinfo;
50
56 protected $queryParams;
57
64 protected $languages;
65
71 protected $headers;
72
76 public function setHeaders(array $headers)
77 {
78 $this->headers = $headers;
79 }
80
84 public function setHost($host)
85 {
86 $this->host = $host;
87 }
88
92 public function setLanguages(array $languages)
93 {
94 $this->languages = $languages;
95 }
96
100 public function setPathinfo($pathinfo)
101 {
102 $this->pathinfo = $pathinfo;
103 }
104
108 public function setPort($port)
109 {
110 $this->port = $port;
111 }
112
116 public function setQueryParams(array $queryParams)
117 {
118 $this->queryParams = $queryParams;
119 }
120
124 public function setScheme($scheme)
125 {
126 $this->scheme = $scheme;
127 }
128
138 public static function fromUrl($url)
139 {
140 $elements = parse_url($url);
141 $elements['pathinfo'] = isset($elements['path']) ? $elements['path'] : '';
142
143 if (isset($elements['query'])) {
144 parse_str($elements['query'], $queryParams);
145 $elements['queryParams'] = $queryParams;
146 }
147
148 // Remove unwanted keys returned by parse_url() so that we don't have them as properties.
149 unset($elements['path'], $elements['query'], $elements['user'], $elements['pass'], $elements['fragment']);
150
151 return new static($elements);
152 }
153
154 public function __sleep()
155 {
156 // Clean up headers for serialization not have a too heavy string (i.e. for ESI/Hinclude tags).
157 $this->headers = [];
158
159 return ['scheme', 'host', 'port', 'pathinfo', 'queryParams', 'languages', 'headers'];
160 }
161 }
eZ\Publish\API\Repository\Values\ValueObject
Definition: API/Repository/Values/ValueObject.php:21
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest
Definition: SimplifiedRequest.php:21
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\setHost
setHost($host)
Definition: SimplifiedRequest.php:84
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\$languages
$languages
Definition: SimplifiedRequest.php:64
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\fromUrl
static fromUrl($url)
Constructs a SimplifiedRequest object from a standard URL (http://www.example.com/foo/bar?...
Definition: SimplifiedRequest.php:138
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\setHeaders
setHeaders(array $headers)
Definition: SimplifiedRequest.php:76
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\__sleep
__sleep()
Definition: SimplifiedRequest.php:154
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\$pathinfo
$pathinfo
Definition: SimplifiedRequest.php:49
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\$port
$port
Definition: SimplifiedRequest.php:41
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\setPathinfo
setPathinfo($pathinfo)
Definition: SimplifiedRequest.php:100
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\setPort
setPort($port)
Definition: SimplifiedRequest.php:108
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\$scheme
$scheme
Definition: SimplifiedRequest.php:27
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\$host
$host
Definition: SimplifiedRequest.php:34
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\$headers
$headers
Definition: SimplifiedRequest.php:71
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\setScheme
setScheme($scheme)
Definition: SimplifiedRequest.php:124
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\setQueryParams
setQueryParams(array $queryParams)
Definition: SimplifiedRequest.php:116
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\setLanguages
setLanguages(array $languages)
Definition: SimplifiedRequest.php:92
eZ\Publish\Core\MVC\Symfony\Routing\SimplifiedRequest\$queryParams
$queryParams
Definition: SimplifiedRequest.php:56
eZ\Publish\Core\MVC\Symfony\Routing
Definition: ChainRouter.php:7
host-p
Returns the Data Source Name as a structure containing the various parts of the DSN.
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.