ImportRequest::getContext()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Mathielen\ImportEngine\ValueObject;
4
5
class ImportRequest
6
{
7
    private $sourceId;
8
    private $sourceProviderId = 'default';
9
    private $importerId = null;
10
    private $createdBy = null;
11
    private $context;
12
13
    public static function createWithoutSource($importerId, $createdBy = null)
14
    {
15
        return new self(null, 'default', $importerId, $createdBy);
16
    }
17
18 1
    public function __construct($sourceId = null, $sourceProviderId = 'default', $importerId = null, $createdBy = null, $context = null)
19
    {
20 1
        $this->sourceId = $sourceId;
21 1
        $this->sourceProviderId = $sourceProviderId;
22 1
        $this->importerId = $importerId;
23 1
        $this->createdBy = $createdBy;
24 1
        $this->context = $context;
25 1
    }
26
27
    /**
28
     * @return ImportRequest
29
     */
30
    public function setImporterId($importerId)
31
    {
32
        $this->importerId = $importerId;
33
34
        return $this;
35
    }
36
37
    /**
38
     * @return string
39
     */
40 1
    public function getSourceId()
41
    {
42 1
        return $this->sourceId;
43
    }
44
45
    /**
46
     * @return string|null
47
     */
48 1
    public function getSourceProviderId()
49
    {
50 1
        return $this->sourceProviderId;
51
    }
52
53
    /**
54
     * @return string|null
55
     */
56 1
    public function getImporterId()
57
    {
58 1
        return $this->importerId;
59
    }
60
61
    /**
62
     * @return string|null
63
     */
64 1
    public function getCreatedBy()
65
    {
66 1
        return $this->createdBy;
67
    }
68
69 1
    public function hasImporterId()
70
    {
71 1
        return !is_null($this->importerId);
72
    }
73
74 1
    public function hasSource()
75
    {
76 1
        return !is_null($this->sourceId);
77
    }
78
79 1
    public function getContext()
80
    {
81 1
        return $this->context;
82
    }
83
}
84