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

TrackedMemory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 7
dl 0
loc 21
rs 10
c 1
b 0
f 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A saveData() 0 4 1
A __construct() 0 3 1
A loadData() 0 3 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