Passed
Pull Request — master (#653)
by Aleksei
06:27
created

TrackedMemory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 21
rs 10
c 0
b 0
f 0
wmc 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Tests\Framework\Cycle;
6
7
use Spiral\Boot\Memory;
8
use Spiral\Boot\MemoryInterface;
9
10
class TrackedMemory implements MemoryInterface
11
{
12
    /** @var int */
13
    public $saveCount = 0;
14
    /** @var Memory */
15
    private $memory;
16
17
    public function __construct(Memory $memory)
18
    {
19
        $this->memory = $memory;
20
    }
21
22
    public function loadData(string $section)
23
    {
24
        return $this->memory->loadData($section);
25
    }
26
27
    public function saveData(string $section, $data): void
28
    {
29
        $this->saveCount++;
30
        $this->memory->saveData($section, $data);
31
    }
32
}
33