1 | <?php |
||
22 | class Transport |
||
23 | { |
||
24 | /** |
||
25 | * @var \SoapClient |
||
26 | */ |
||
27 | protected $client; |
||
28 | |||
29 | /** |
||
30 | * @var int |
||
31 | */ |
||
32 | protected $list; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $campaign; |
||
38 | |||
39 | /** |
||
40 | * @var LoggerInterface |
||
41 | */ |
||
42 | protected $logger = null; |
||
43 | |||
44 | /** |
||
45 | * @param \SoapClient $client |
||
46 | * @param string $list |
||
47 | * @param string $campaign |
||
48 | */ |
||
49 | 11 | public function __construct(\SoapClient $client, $list = null, $campaign = null) |
|
60 | |||
61 | /** |
||
62 | * {@inheritDoc} |
||
63 | */ |
||
64 | 7 | public function setLogger(LoggerInterface $logger) |
|
68 | |||
69 | /** |
||
70 | * |
||
71 | * @param string $list Name of the list |
||
72 | * @throws Exception if the list was not found in the remote server |
||
73 | * @return self |
||
74 | */ |
||
75 | 10 | public function setList($list) |
|
87 | |||
88 | /** |
||
89 | * @return int |
||
90 | */ |
||
91 | 2 | public function getList() |
|
95 | |||
96 | /** |
||
97 | * |
||
98 | * @param string $campaign Gate Name |
||
99 | * @return self |
||
100 | */ |
||
101 | 9 | public function setCampaign($campaign) |
|
107 | |||
108 | /** |
||
109 | * @return string |
||
110 | */ |
||
111 | 2 | public function getCampaign() |
|
115 | |||
116 | /** |
||
117 | * @param GetUserByFilterResponse $response |
||
118 | * @param string $idKey |
||
119 | * |
||
120 | * @return integer |
||
121 | */ |
||
122 | 2 | private function getExistingUserId(GetUserByFilterResponse $response, $idKey) |
|
139 | |||
140 | /** |
||
141 | * @param Properties $user |
||
142 | * @return integer |
||
143 | */ |
||
144 | 2 | private function createUser(Properties $user) |
|
165 | |||
166 | /** |
||
167 | * Subscribe the given user, if not already in list, and returns his identifier |
||
168 | * |
||
169 | * @param Properties $user |
||
170 | * @return int User id |
||
171 | * @throws UnexpectedValueException if $idKey is not an existing Property |
||
172 | * @throws Exception If something happens during the request |
||
173 | */ |
||
174 | 5 | public function subscribe(Properties $user, $idKey = 'ID') |
|
211 | |||
212 | /** |
||
213 | * @param int $userId |
||
214 | * @param Properties $inputData |
||
215 | * @return string |
||
216 | * @throws Exception |
||
217 | */ |
||
218 | 2 | public function triggerCampaign($userId, Properties $inputData) |
|
253 | } |
||
254 |