Conditions | 3 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
40 | 4 | public function getPost($postId, $force = false) |
|
41 | { |
||
42 | 4 | $cacheKey = sprintf('%s.post.%d', self::CACHE_KEY_PREFIX, $postId); |
|
43 | |||
44 | 4 | if (!$force && $post = $this->cache->fetch($cacheKey)) { |
|
45 | 1 | return $post; |
|
46 | } |
||
47 | |||
48 | 3 | $post = $this->client->post($postId); |
|
49 | 3 | $this->cache->save($cacheKey, $post); |
|
50 | |||
51 | 3 | return $post; |
|
52 | } |
||
71 |