| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 49 | 3 | public function getJobStats($jobName) |
|
| 50 | { |
||
| 51 | 3 | $cacheKey = sprintf(self::CACHE_KEY_JOB_STATS, $jobName); |
|
| 52 | 3 | $stats = $this->cache->get($cacheKey); |
|
| 53 | |||
| 54 | 3 | if (empty($stats)) { |
|
| 55 | 2 | $stats = $this->apiClient->getJobStats($jobName); |
|
| 56 | |||
| 57 | // set result to cache |
||
| 58 | 2 | if (!empty($stats)) { |
|
| 59 | 1 | $this->cache->set($cacheKey, $stats, self::CACHE_TIME_JOB_STATS); |
|
| 60 | } |
||
| 61 | } |
||
| 62 | |||
| 63 | 3 | return new JobStatsEntity($stats); |
|
| 64 | } |
||
| 65 | } |
||
| 66 |