1 | <?php |
||
7 | class QueryParameters |
||
8 | { |
||
9 | /** |
||
10 | * The Request object. |
||
11 | * |
||
12 | * @var \Psr\Http\Message\RequestInterface |
||
13 | */ |
||
14 | protected $request; |
||
15 | |||
16 | public static function create(RequestInterface $request) |
||
20 | |||
21 | /** |
||
22 | * Initialize the class. |
||
23 | * |
||
24 | * @param \Psr\Http\Message\RequestInterface $request |
||
25 | * @return void |
||
|
|||
26 | */ |
||
27 | public function __construct(RequestInterface $request) |
||
31 | |||
32 | /** |
||
33 | * Get all query parameters. |
||
34 | * |
||
35 | * @return array |
||
36 | */ |
||
37 | public function all(): array |
||
45 | |||
46 | /** |
||
47 | * Get a specific query parameter. |
||
48 | * |
||
49 | * @param string $name |
||
50 | * @return string |
||
51 | */ |
||
52 | public function get(string $name): string |
||
56 | } |
||
57 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.