ImportRequest   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Test Coverage

Coverage 80.77%

Importance

Changes 0
Metric Value
wmc 10
lcom 2
cbo 0
dl 0
loc 79
ccs 21
cts 26
cp 0.8077
rs 10
c 0
b 0
f 0

10 Methods

Rating   Name   Duplication   Size   Complexity  
A createWithoutSource() 0 4 1
A __construct() 0 8 1
A setImporterId() 0 6 1
A getSourceId() 0 4 1
A getSourceProviderId() 0 4 1
A getImporterId() 0 4 1
A getCreatedBy() 0 4 1
A hasImporterId() 0 4 1
A hasSource() 0 4 1
A getContext() 0 4 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