TStorage::setStorage()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
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