Conditions | 4 |
Paths | 6 |
Total Lines | 15 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | public function load($key, $closure, $lifetime = 60) |
||
16 | { |
||
17 | if (is_array($key)) { |
||
18 | $key = $this->key($key); |
||
19 | } |
||
20 | if ($lifetime == 0) { |
||
21 | return $closure(); |
||
22 | } |
||
23 | $data = $this->cache->get($key, $lifetime); |
||
|
|||
24 | if (!$data) { |
||
25 | $data = $closure(); |
||
26 | $this->cache->save($key, $data, $lifetime); |
||
27 | } |
||
28 | return $data; |
||
29 | } |
||
30 | |||
52 | } |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.