@@ 74-83 (lines=10) @@ | ||
71 | }); |
|
72 | } |
|
73 | ||
74 | protected function checkCache(string $path) |
|
75 | { |
|
76 | if ($this->cache instanceof CacheInterface) { |
|
77 | return $this->cache->get($path)->then(function ($json) use ($path) { |
|
78 | return $this->jsonDecode($json); |
|
79 | }); |
|
80 | } |
|
81 | ||
82 | return reject(); |
|
83 | } |
|
84 | ||
85 | protected function sendRequest(string $path, string $method = 'GET'): PromiseInterface |
|
86 | { |
|
@@ 97-102 (lines=6) @@ | ||
94 | $deferred->reject($error); |
|
95 | }); |
|
96 | ||
97 | return $deferred->promise()->then(function ($json) use ($path) { |
|
98 | if ($this->cache instanceof CacheInterface) { |
|
99 | $this->cache->set($path, $json); |
|
100 | } |
|
101 | return $this->jsonDecode($json); |
|
102 | }); |
|
103 | } |
|
104 | ||
105 | protected function createRequest(string $method, string $path) |