ArrayCache   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A remember() 0 8 2
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