Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
38 | 2 | public function format($value) { |
|
39 | 2 | if(!($value instanceof DataValue)) { |
|
40 | throw new InvalidArgumentException('$value is not a DataValue.'); |
||
41 | } |
||
42 | |||
43 | try { |
||
44 | 1 | return $this->cache->fetch($value); |
|
45 | } catch(OutOfBoundsException $e) { |
||
46 | $jsonLd = $this->formatter->format($value); |
||
47 | $this->cache->save($value, $jsonLd); |
||
48 | 1 | return $jsonLd; |
|
49 | 1 | } |
|
50 | } |
||
51 | } |
||
52 |