1 | <?php |
||
32 | class Api |
||
33 | { |
||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private $organizationId; |
||
38 | |||
39 | /** |
||
40 | * @var HttpClient |
||
41 | */ |
||
42 | private $http; |
||
43 | |||
44 | /** |
||
45 | * @var Endpoint[] |
||
46 | */ |
||
47 | private $endpoints; |
||
48 | |||
49 | public function __construct(HttpClient $http, Endpoint ...$endpoints) |
||
56 | |||
57 | /** |
||
58 | * Magic method to access different endpoints. |
||
59 | * |
||
60 | * @param string $alias |
||
61 | * |
||
62 | * @return Endpoint |
||
63 | * @throws WrongEndpoint |
||
64 | */ |
||
65 | public function __get($alias) |
||
71 | |||
72 | /** |
||
73 | * @param string $organizationName |
||
74 | * @return $this |
||
75 | * @throws WrongOrganizationName |
||
76 | */ |
||
77 | public function useOrganization($organizationName) |
||
85 | |||
86 | /** |
||
87 | * @param string $organizationName |
||
88 | * @return array|bool |
||
89 | * @throws WrongOrganizationName |
||
90 | */ |
||
91 | private function getOrganizationByName($organizationName) |
||
102 | |||
103 | /** |
||
104 | * @param string $alias |
||
105 | * @return Endpoint |
||
106 | * @throws WrongEndpoint |
||
107 | */ |
||
108 | private function resolveEndpoint($alias) |
||
118 | |||
119 | /** |
||
120 | * @return array |
||
121 | */ |
||
122 | public function getRateInfo() |
||
132 | } |
||
133 |