TStorage::getStorage()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

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