1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Configuration\Jms\Configuration\Plugin |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-configuration-jms |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Configuration\Jms\Configuration; |
22
|
|
|
|
23
|
|
|
use JMS\Serializer\Annotation\Type; |
24
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
25
|
|
|
use JMS\Serializer\Annotation\PostDeserialize; |
26
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
27
|
|
|
use TechDivision\Import\ConfigurationInterface; |
28
|
|
|
use TechDivision\Import\Configuration\PluginConfigurationInterface; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* A simple plugin configuration implementation. |
32
|
|
|
* |
33
|
|
|
* @author Tim Wagner <[email protected]> |
34
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
35
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
36
|
|
|
* @link https://github.com/techdivision/import-configuration-jms |
37
|
|
|
* @link http://www.techdivision.com |
38
|
|
|
*/ |
39
|
|
|
class Plugin implements PluginConfigurationInterface |
40
|
|
|
{ |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* The trait that provides parameter configuration functionality. |
44
|
|
|
* |
45
|
|
|
* @var \TechDivision\Import\Configuration\Jms\Configuration\ParamsTrait |
46
|
|
|
*/ |
47
|
|
|
use ParamsTrait; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* The main configuration. |
51
|
|
|
* |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
protected $configuration; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* The plugin's unique DI identifier. |
58
|
|
|
* |
59
|
|
|
* @var string |
60
|
|
|
* @Type("string") |
61
|
|
|
* @SerializedName("id") |
62
|
|
|
*/ |
63
|
|
|
protected $id; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* ArrayCollection with the information of the configured subjects. |
67
|
|
|
* |
68
|
|
|
* @var \Doctrine\Common\Collections\ArrayCollection |
69
|
|
|
* @Type("ArrayCollection<TechDivision\Import\Configuration\Jms\Configuration\Subject>") |
70
|
|
|
*/ |
71
|
|
|
protected $subjects; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* The swift mailer configuration to use. |
75
|
|
|
* |
76
|
|
|
* @var \TechDivision\Import\Configuration\Jms\Configuration\SwiftMailer |
77
|
|
|
* @Type("TechDivision\Import\Configuration\Jms\Configuration\SwiftMailer") |
78
|
|
|
* @SerializedName("swift-mailer") |
79
|
|
|
*/ |
80
|
|
|
protected $swiftMailer; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Lifecycle callback that will be invoked after deserialization. |
84
|
|
|
* |
85
|
|
|
* @return void |
86
|
|
|
* @PostDeserialize |
87
|
|
|
*/ |
88
|
|
|
public function postDeserialize() |
89
|
|
|
{ |
90
|
|
|
|
91
|
|
|
// create an empty collection if no subjects has been specified |
92
|
|
|
if ($this->subjects === null) { |
93
|
|
|
$this->subjects = new ArrayCollection(); |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Set's the reference to the configuration instance. |
99
|
|
|
* |
100
|
|
|
* @param \TechDivision\Import\ConfigurationInterface $configuration The configuration instance |
101
|
|
|
* |
102
|
|
|
* @return void |
103
|
|
|
*/ |
104
|
|
|
public function setConfiguration(ConfigurationInterface $configuration) |
105
|
|
|
{ |
106
|
|
|
$this->configuration = $configuration; |
|
|
|
|
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* Return's the reference to the configuration instance. |
111
|
|
|
* |
112
|
|
|
* @return \TechDivision\Import\ConfigurationInterface The configuration instance |
113
|
|
|
*/ |
114
|
|
|
public function getConfiguration() |
115
|
|
|
{ |
116
|
|
|
return $this->configuration; |
|
|
|
|
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Return's the subject's unique DI identifier. |
121
|
|
|
* |
122
|
|
|
* @return string The subject's unique DI identifier |
123
|
|
|
*/ |
124
|
|
|
public function getId() |
125
|
|
|
{ |
126
|
|
|
return $this->id; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Return's the ArrayCollection with the operation's subjects. |
131
|
|
|
* |
132
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the operation's subjects |
133
|
|
|
*/ |
134
|
|
|
public function getSubjects() |
135
|
|
|
{ |
136
|
|
|
return $this->subjects; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Return's the swift mailer configuration to use. |
141
|
|
|
* |
142
|
|
|
* @return TechDivision\Import\Configuration\Jms\Configuration\SwiftMailer The swift mailer configuration to use |
143
|
|
|
*/ |
144
|
|
|
public function getSwiftMailer() |
145
|
|
|
{ |
146
|
|
|
return $this->swiftMailer; |
147
|
|
|
} |
148
|
|
|
} |
149
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..