Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
37 | public function requestContent($method, $uri = '', array $options = [], $cacheKey = '') { |
||
38 | $cacheKey = md5($cacheKey); |
||
39 | |||
40 | $cachedString = $this->instanceCache->getItem($cacheKey); |
||
41 | |||
42 | if (is_null($cachedString->get())) { |
||
43 | $client = new Client(); |
||
44 | |||
45 | $res = $client->request($method, $uri, $options); |
||
46 | $content = json_decode($res->getBody()->getContents(), true); |
||
47 | |||
48 | //in seconds, also accepts Datetime |
||
49 | $cachedString->set($content)->expiresAfter(30 * 24 * 3600); |
||
50 | |||
51 | // Save the cache item just like you do with doctrine and entities |
||
52 | $this->instanceCache->save($cachedString); |
||
53 | |||
54 | // "FIRST LOAD // WROTE OBJECT TO CACHE // RELOAD THE PAGE AND SEE // "; |
||
55 | return $cachedString->get(); |
||
|
|||
56 | } |
||
57 | |||
58 | // "READ FROM CACHE // "; |
||
59 | return $cachedString->get(); |
||
60 | } |
||
62 | } |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.