1 | <?php |
||
7 | class Endpoint |
||
8 | { |
||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $allowedMethods = [ |
||
13 | 'getById', |
||
14 | 'getAll', |
||
15 | 'create', |
||
16 | 'update', |
||
17 | 'delete', |
||
18 | ]; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $endpoint; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $headers = []; |
||
29 | |||
30 | /** |
||
31 | * @var HttpClient |
||
32 | */ |
||
33 | protected $http; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $organizationId; |
||
39 | |||
40 | /** |
||
41 | * @param HttpClient $http |
||
42 | */ |
||
43 | public function __construct(HttpClient $http) |
||
47 | |||
48 | /** |
||
49 | * @param string $verb |
||
50 | * @return string |
||
51 | */ |
||
52 | public function makeRequestUrl($verb = '') |
||
56 | |||
57 | /** |
||
58 | * @param string $method |
||
59 | * @return bool |
||
60 | */ |
||
61 | public function isMethodAllowed($method) |
||
65 | |||
66 | /** |
||
67 | * @return HttpClient |
||
68 | */ |
||
69 | public function getHttp() |
||
73 | |||
74 | /** |
||
75 | * @param array $params |
||
76 | * @return array |
||
77 | */ |
||
78 | public function getAll(array $params = []) |
||
84 | |||
85 | /** |
||
86 | * @param string $id |
||
87 | * @return array |
||
88 | */ |
||
89 | public function getById($id) |
||
95 | |||
96 | /** |
||
97 | * @return array |
||
98 | */ |
||
99 | protected function getHeaders() |
||
106 | |||
107 | /** |
||
108 | * @param int $organizationId |
||
109 | * @return $this |
||
110 | */ |
||
111 | public function setOrganizationId($organizationId) |
||
117 | } |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.