Passed
Push — master ( b71d8d...e6115e )
by Petr
02:57
created

TData::getInfoData()   A

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
nc 2
nop 0
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace kalanis\UploadPerPartes\Traits;
4
5
6
use kalanis\UploadPerPartes\Exceptions\UploadException;
7
use kalanis\UploadPerPartes\InfoFormat;
8
9
10
/**
11
 * Trait TData
12
 * @package kalanis\UploadPerPartes\Traits
13
 * Translations
14
 */
15
trait TData
16
{
17
    use TLang;
18
19
    /** @var null|InfoFormat\Data */
20
    protected $data = null;
21
22 17
    public function setInfoData(?InfoFormat\Data $data = null): self
23
    {
24 17
        $this->data = $data;
25 17
        return $this;
26
    }
27
28
    /**
29
     * @throws UploadException
30
     * @return InfoFormat\Data
31
     */
32 18
    public function getInfoData(): InfoFormat\Data
33
    {
34 18
        if (empty($this->data)) {
35 1
            throw new UploadException($this->getUppLang()->uppDriveDataNotSet());
36
        }
37 17
        return $this->data;
38
    }
39
}
40