1 | <?php |
||
20 | class RequestHandlerMiddleware |
||
21 | { |
||
22 | |||
23 | |||
24 | /** |
||
25 | * Request object |
||
26 | * |
||
27 | * @var \Cake\Network\Request |
||
28 | */ |
||
29 | public $request; |
||
30 | |||
31 | /** |
||
32 | * @param \Psr\Http\Message\ServerRequestInterface $request The request. |
||
33 | * @param \Psr\Http\Message\ResponseInterface $response The response. |
||
34 | * @param callable $next The next middleware to call. |
||
35 | * @return \Psr\Http\Message\ResponseInterface A response. |
||
36 | */ |
||
37 | public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next) |
||
59 | |||
60 | |||
61 | /** |
||
62 | * Determines the content type of the data the client has sent (i.e. in a POST request) |
||
63 | * |
||
64 | * @param string|array|null $type Can be null (or no parameter), a string type name, or an array of types |
||
65 | * @return mixed If a single type is supplied a boolean will be returned. If no type is provided |
||
66 | * The mapped value of CONTENT_TYPE will be returned. If an array is supplied the first type |
||
67 | * in the request content type will be returned. |
||
68 | */ |
||
69 | public function requestedWith($type = null) |
||
98 | |||
99 | /** |
||
100 | * Helper method to parse xml input data, due to lack of anonymous functions |
||
101 | * this lives here. |
||
102 | * |
||
103 | * @param string $xml XML string. |
||
104 | * @return array Xml array data |
||
105 | */ |
||
106 | public function convertXml($xml) |
||
119 | |||
120 | |||
121 | } |
||
122 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: