1 | <?php |
||
24 | class Client |
||
25 | { |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $sApiUrl; |
||
30 | /** |
||
31 | * Cache handler |
||
32 | * |
||
33 | * @var CacheInterface |
||
34 | */ |
||
35 | private $oCache; |
||
36 | /** |
||
37 | * @var Adapter |
||
38 | */ |
||
39 | private $oCacheAdapter; |
||
40 | /** |
||
41 | * Logger handler |
||
42 | * |
||
43 | * @var \Psr\Log\LoggerInterface |
||
44 | */ |
||
45 | private $oLogger; |
||
46 | |||
47 | /** |
||
48 | * Client constructor. |
||
49 | * |
||
50 | * @param string $apiUrl |
||
51 | */ |
||
52 | 13 | public function __construct(string $apiUrl = 'https://api-v3.mojepanstwo.pl/') |
|
58 | |||
59 | /** |
||
60 | * @param string $url |
||
61 | * |
||
62 | * @return mixed |
||
63 | * @throws \mrcnpdlk\MojePanstwo\Exception |
||
64 | */ |
||
65 | 8 | private function curlRequest(string $url) |
|
91 | |||
92 | /** |
||
93 | * Get logger instance |
||
94 | * |
||
95 | * @return \Psr\Log\LoggerInterface |
||
96 | */ |
||
97 | 10 | public function getLogger() |
|
101 | |||
102 | /** |
||
103 | * @param string $sPrefixedContext |
||
104 | * @param string|null $id |
||
105 | * @param \mrcnpdlk\MojePanstwo\QueryBuilder|null $oParams |
||
106 | * |
||
107 | * @return \stdClass |
||
108 | * @internal param string $context |
||
109 | */ |
||
110 | 8 | public function request(string $sPrefixedContext, string $id = null, QueryBuilder $oParams = null) |
|
134 | |||
135 | /** |
||
136 | * Setting Cache Adapter |
||
137 | * |
||
138 | * @return $this |
||
139 | */ |
||
140 | 13 | private function setCacheAdapter() |
|
146 | |||
147 | /** |
||
148 | * Set Cache handler (PSR-16) |
||
149 | * |
||
150 | * @param \Psr\SimpleCache\CacheInterface|null $oCache |
||
151 | * |
||
152 | * @return \mrcnpdlk\MojePanstwo\Client |
||
153 | * @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-16-simple-cache.md PSR-16 |
||
154 | */ |
||
155 | 13 | public function setCacheInstance(CacheInterface $oCache = null) |
|
162 | |||
163 | /** |
||
164 | * Set Logger handler (PSR-3) |
||
165 | * |
||
166 | * @param \Psr\Log\LoggerInterface|null $oLogger |
||
167 | * |
||
168 | * @return $this |
||
169 | */ |
||
170 | 13 | public function setLoggerInstance(LoggerInterface $oLogger = null) |
|
177 | |||
178 | } |
||
179 |