1 | <?php |
||
32 | class Api |
||
33 | { |
||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private $organizationId; |
||
38 | |||
39 | /** |
||
40 | * @var HttpClient |
||
41 | */ |
||
42 | private $httpClient; |
||
43 | |||
44 | /** |
||
45 | * @var Endpoint[] |
||
46 | */ |
||
47 | private $endpoints; |
||
48 | |||
49 | public function __construct(HttpClient $httpClient, Endpoint ...$endpoints) |
||
56 | |||
57 | /** |
||
58 | * Magic method to access different endpoints. |
||
59 | * |
||
60 | * @param string $endpoint |
||
61 | * |
||
62 | * @return Endpoint |
||
63 | * @throws WrongEndpoint |
||
64 | */ |
||
65 | public function __get($endpoint) |
||
75 | |||
76 | /** |
||
77 | * @param string $organizationName |
||
78 | * @return $this |
||
79 | * @throws WrongOrganizationName |
||
80 | */ |
||
81 | public function setOrganization($organizationName) |
||
89 | |||
90 | /** |
||
91 | * @param int $organizationId |
||
92 | * @return $this |
||
93 | */ |
||
94 | public function setOrganizationId($organizationId) |
||
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getOrganizationId() |
||
108 | |||
109 | /** |
||
110 | * @param $organizationName |
||
111 | * @return array|bool |
||
112 | * @throws WrongOrganizationName |
||
113 | */ |
||
114 | private function getOrganizationByName($organizationName) |
||
125 | |||
126 | /** |
||
127 | * @param string $endpoint |
||
128 | * @return Endpoint |
||
129 | * @throws WrongEndpoint |
||
130 | */ |
||
131 | private function resolveEndpoint($endpoint) |
||
141 | |||
142 | /** |
||
143 | * @return array |
||
144 | */ |
||
145 | public function getRateInfo() |
||
155 | } |
||
156 |
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.