1 | <?php |
||
31 | class EndpointsContainer |
||
32 | { |
||
33 | /** |
||
34 | * @var Request |
||
35 | */ |
||
36 | protected $request; |
||
37 | |||
38 | /** |
||
39 | * Array with the cached endpoints |
||
40 | * @var Endpoint[] |
||
41 | */ |
||
42 | protected $endpoints = []; |
||
43 | |||
44 | public function __construct(Request $request) |
||
48 | |||
49 | /** |
||
50 | * @param string $endpoint |
||
51 | * @return Endpoint |
||
52 | */ |
||
53 | public function __get($endpoint) |
||
57 | |||
58 | /** |
||
59 | * @param string $method |
||
60 | * @param array $arguments |
||
61 | * @return EndpointsContainer |
||
62 | * @throws HeadHunterApiException |
||
63 | */ |
||
64 | public function __call($method, $arguments) |
||
72 | |||
73 | /** |
||
74 | * @param string $endpoint |
||
75 | * @return Endpoint |
||
76 | * @throws WrongEndPointException |
||
77 | */ |
||
78 | public function getEndpoint($endpoint) |
||
86 | |||
87 | /** |
||
88 | * @param string $endpoint |
||
89 | * @throws WrongEndPointException |
||
90 | */ |
||
91 | protected function addEndpoint($endpoint) |
||
101 | |||
102 | /** |
||
103 | * @return Request |
||
104 | */ |
||
105 | public function getRequest() |
||
109 | |||
110 | /** |
||
111 | * @param string $method |
||
112 | * @param array $arguments |
||
113 | * @return $this |
||
114 | */ |
||
115 | protected function callRequestSetter($method, $arguments) |
||
121 | |||
122 | /** |
||
123 | * @param string $method |
||
124 | * @return bool |
||
125 | */ |
||
126 | protected function isRequestSetter($method) |
||
130 | |||
131 | /** |
||
132 | * @param string $class |
||
133 | * @return bool |
||
134 | */ |
||
135 | protected function checkIsEndpoint($class) |
||
141 | } |