1 | <?php |
||
22 | class Request extends Message implements RequestInterface |
||
23 | { |
||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $method; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $target; |
||
33 | |||
34 | /** |
||
35 | * @var UriInterface |
||
36 | */ |
||
37 | private $uri; |
||
38 | |||
39 | /** |
||
40 | * Creates an HTTP Request message |
||
41 | * |
||
42 | * @param string $method |
||
43 | * @param string|StreamInterface $body |
||
44 | * @param null|string|UriInterface $target |
||
45 | * @param array $headers |
||
46 | */ |
||
47 | public function __construct($method, $target = null ,$body = '', array $headers = []) |
||
60 | |||
61 | /** |
||
62 | * Retrieves the message's request target. |
||
63 | * |
||
64 | * If no URI is available, and no request-target has been specifically |
||
65 | * provided, this method MUST return the string "/". |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getRequestTarget() |
||
75 | |||
76 | /** |
||
77 | * Return an instance with the specific request-target. |
||
78 | * |
||
79 | * @link http://tools.ietf.org/html/rfc7230#section-5.3 (for the various |
||
80 | * request-target forms allowed in request messages) |
||
81 | * @param mixed $requestTarget |
||
82 | * @return static |
||
83 | */ |
||
84 | public function withRequestTarget($requestTarget) |
||
90 | |||
91 | /** |
||
92 | * Retrieves the HTTP method of the request. |
||
93 | * |
||
94 | * @return string Returns the request method. |
||
95 | */ |
||
96 | public function getMethod() |
||
100 | |||
101 | /** |
||
102 | * Return an instance with the provided HTTP method. |
||
103 | * |
||
104 | * @param string $method Case-sensitive method. |
||
105 | * @return static |
||
106 | * @throws InvalidArgumentException for invalid HTTP methods. |
||
107 | */ |
||
108 | public function withMethod($method) |
||
126 | |||
127 | /** |
||
128 | * Retrieves the URI instance. |
||
129 | * |
||
130 | * @link http://tools.ietf.org/html/rfc3986#section-4.3 |
||
131 | * @return UriInterface Returns a UriInterface instance |
||
132 | * representing the URI of the request. |
||
133 | */ |
||
134 | public function getUri() |
||
138 | |||
139 | /** |
||
140 | * Returns an instance with the provided URI. |
||
141 | * |
||
142 | * @link http://tools.ietf.org/html/rfc3986#section-4.3 |
||
143 | * @param UriInterface $uri New request URI to use. |
||
144 | * @param bool $preserveHost Preserve the original state of the Host header. |
||
145 | * @return static |
||
146 | */ |
||
147 | public function withUri(UriInterface $uri, $preserveHost = false) |
||
153 | |||
154 | /** |
||
155 | * Sets the request URI |
||
156 | * |
||
157 | * @param UriInterface $uri |
||
158 | * @param bool $preserveHost |
||
159 | */ |
||
160 | protected function setUri(UriInterface $uri, $preserveHost = false) |
||
169 | |||
170 | /** |
||
171 | * Get the target from the uri |
||
172 | * |
||
173 | * @return string |
||
174 | */ |
||
175 | private function getTargetFromUri() |
||
186 | } |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.