Passed
Pull Request — master (#298)
by Valentin
04:51
created

TrackedMemory::saveData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
rs 10
c 1
b 0
f 1
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