ArrayCache::remember()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace AcquiroPay\Cache;
6
7
use Closure;
8
use AcquiroPay\Contracts\Cache;
9
10
class ArrayCache implements Cache
11
{
12
    protected $items = [];
13
14
    public function remember(string $key, int $minutes, Closure $callback)
15
    {
16
        if (isset($this->items[$key])) {
17
            return $this->items[$key];
18
        }
19
20
        return $this->items[$key] = value($callback);
21
    }
22
}
23