1 | <?php |
||
9 | class Request implements RequestInterface |
||
10 | { |
||
11 | /** |
||
12 | * The HTTP verb. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $verb; |
||
17 | |||
18 | /** |
||
19 | * The endpoint. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $endpoint; |
||
24 | |||
25 | /** |
||
26 | * The options. |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $options = []; |
||
31 | |||
32 | /** |
||
33 | * Set the base API URL. |
||
34 | * |
||
35 | * @param string $url |
||
36 | * @return void |
||
|
|||
37 | */ |
||
38 | public function __construct($url) |
||
42 | |||
43 | /** |
||
44 | * Set the HTTP verb. |
||
45 | * |
||
46 | * @param string $verb |
||
47 | * @return $this |
||
48 | */ |
||
49 | public function setVerb($verb) |
||
55 | |||
56 | /** |
||
57 | * Retrieve the HTTP verb. |
||
58 | * |
||
59 | * @return string |
||
60 | */ |
||
61 | public function verb() |
||
65 | |||
66 | /** |
||
67 | * Set the endpoint. |
||
68 | * |
||
69 | * @param string $endpoint |
||
70 | * @return $this |
||
71 | */ |
||
72 | public function setEndpoint($endpoint) |
||
80 | |||
81 | /** |
||
82 | * Normalize the API endpoint. |
||
83 | * |
||
84 | * @param string $endpoint |
||
85 | * @return void |
||
86 | */ |
||
87 | private function normalizeEndpoint(&$endpoint) |
||
93 | |||
94 | /** |
||
95 | * Retrieve the endpoint. |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | public function endpoint() |
||
103 | |||
104 | /** |
||
105 | * Set the options. |
||
106 | * |
||
107 | * @param array $options |
||
108 | * @return $this |
||
109 | */ |
||
110 | public function setOptions(array $options) |
||
116 | |||
117 | /** |
||
118 | * Retrieve the options. |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | public function options() |
||
126 | } |
||
127 |
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.