1 | <?php |
||
22 | final class Request |
||
23 | { |
||
24 | /** |
||
25 | * The http method. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | private $method; |
||
30 | |||
31 | /** |
||
32 | * The endpoint to call. |
||
33 | * |
||
34 | * Relative url. |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | private $endpoint; |
||
39 | |||
40 | /** |
||
41 | * The parameters to pass. |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | private $params; |
||
46 | |||
47 | /** |
||
48 | * The headers to pass. |
||
49 | * |
||
50 | * @var array |
||
51 | */ |
||
52 | private $headers; |
||
53 | |||
54 | /** |
||
55 | * The constructor. |
||
56 | * |
||
57 | * @param string $method The http method. |
||
58 | * @param string $endpoint The relative url to call. |
||
59 | * @param array $params The parameters. |
||
60 | * @param array $headers The headers. |
||
61 | */ |
||
62 | 34 | public function __construct($method, $endpoint, array $params = array(), array $headers = array()) |
|
69 | |||
70 | /** |
||
71 | * Sets the fields. |
||
72 | * |
||
73 | * @param array $fields The fields to return. |
||
74 | * |
||
75 | * @return Request The current Request instance. |
||
76 | */ |
||
77 | 30 | public function setFields(array $fields) |
|
86 | |||
87 | /** |
||
88 | * Get the http (lowercase) method. |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | 34 | public function getMethod() |
|
96 | |||
97 | /** |
||
98 | * Get the http endpoint. |
||
99 | * |
||
100 | * @return string |
||
101 | */ |
||
102 | 34 | public function getEndpoint() |
|
106 | |||
107 | /** |
||
108 | * Get the http parameters. |
||
109 | * |
||
110 | * @return array |
||
111 | */ |
||
112 | 34 | public function getParams() |
|
116 | |||
117 | /** |
||
118 | * Get the http headers. |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | 34 | public function getHeaders() |
|
126 | |||
127 | /** |
||
128 | * Is this a POST request? |
||
129 | * |
||
130 | * @return bool |
||
131 | */ |
||
132 | public function isPost() |
||
136 | |||
137 | /** |
||
138 | * Is this a GET request? |
||
139 | * |
||
140 | * @return bool |
||
141 | */ |
||
142 | public function isGet() |
||
146 | } |
||
147 |