MemPersistenceAdapter::persist()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
}