1 | <?php |
||
14 | class SplashRequestContext |
||
15 | { |
||
16 | private $urlParameters = array(); |
||
17 | private $request; |
||
18 | |||
19 | public function __construct(ServerRequestInterface $request) |
||
20 | { |
||
21 | $this->request = $request; |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * Add a new parameter. |
||
26 | * |
||
27 | * @param string $key |
||
28 | * @param string $value |
||
29 | */ |
||
30 | public function addUrlParameter($key, $value) |
||
31 | { |
||
32 | $this->urlParameters[$key] = $value; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * Sets all parameters at once. |
||
37 | * |
||
38 | * @param array $urlParameters |
||
39 | */ |
||
40 | public function setUrlParameters(array $urlParameters) |
||
41 | { |
||
42 | $this->urlParameters = $urlParameters; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Returns the list of parameters seen while analysing the URL. |
||
47 | * |
||
48 | * @return array<string, string> |
||
|
|||
49 | */ |
||
50 | public function getUrlParameters() |
||
51 | { |
||
52 | return $this->urlParameters; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Returns the request. |
||
57 | * |
||
58 | * @return ServerRequestInterface |
||
59 | */ |
||
60 | public function getRequest() |
||
61 | { |
||
62 | return $this->request; |
||
63 | } |
||
64 | |||
65 | public function hasParameter($key) : bool |
||
79 | |||
80 | /** |
||
81 | * Scan the URL parameters and the request parameters and return the given parameter (or a default value). |
||
82 | * |
||
83 | * @param string $key |
||
84 | * |
||
85 | * @return mixed |
||
86 | * |
||
87 | * @throws SplashMissingParameterException |
||
88 | */ |
||
89 | public function getParameter(string $key, bool $compulsory, $default = null) |
||
118 | } |
||
119 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.