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
|
|
|
|