TStorage   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getStorage() 0 6 2
A setStorage() 0 3 1
1
<?php
2
3
namespace kalanis\kw_mime\Check\Traits;
4
5
6
use kalanis\kw_mime\MimeException;
7
use kalanis\kw_storage\Storage;
8
9
10
trait TStorage
11
{
12
    use TLang;
13
14
    protected ?Storage $storage = null;
15
16 4
    public function setStorage(Storage $lang = null): void
17
    {
18 4
        $this->storage = $lang;
19
    }
20
21
    /**
22
     * @throws MimeException
23
     * @return Storage
24
     */
25 4
    public function getStorage(): Storage
26
    {
27 4
        if (empty($this->storage)) {
28 1
            throw new MimeException($this->getMiLang()->miNoStorage());
29
        }
30 3
        return $this->storage;
31
    }
32
}
33