MemPersistenceAdapter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A persist() 0 3 1
A getLast() 0 6 2
1
<?php
2
3
namespace cwreden\php7ccAnalyser;
4
5
6
class MemPersistenceAdapter implements PersistenceAdapterInterface
7
{
8
    /**
9
     * @var Scan
10
     */
11
    private $lastScan = null;
12
13
    /**
14
     * @param Scan $scan
15
     */
16 2
    public function persist(Scan $scan): void
17
    {
18 2
        $this->lastScan = $scan;
19 2
    }
20
21
    /**
22
     * @return Scan
23
     * @throws NoPreviousScanFoundException
24
     */
25 3
    public function getLast(): Scan
26
    {
27 3
        if ($this->lastScan === null) {
28 1
            throw new NoPreviousScanFoundException();
29
        }
30 2
        return $this->lastScan;
31
    }
32
}