| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 51 | public function remember(Readable $readable, \Closure $then) |
||
| 52 | { |
||
| 53 | $data = $this->storage->get($readable->getHash()); |
||
| 54 | |||
| 55 | // If entity exists |
||
| 56 | if (\is_object($data)) { |
||
| 57 | return $data; |
||
| 58 | } |
||
| 59 | |||
| 60 | $result = $then($readable); |
||
| 61 | |||
| 62 | $this->storage->set($readable->getHash(), $data, $this->timeout); |
||
| 63 | |||
| 64 | return $result; |
||
| 65 | } |
||
| 66 | } |
||
| 67 |