1 | <?php |
||
23 | class Application |
||
24 | { |
||
25 | /** |
||
26 | * @var CredentialsMapper |
||
27 | */ |
||
28 | private $credentialsMapper; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $credentialsFilePath; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $applicationName; |
||
39 | |||
40 | /** |
||
41 | * @var array |
||
42 | */ |
||
43 | private $config; |
||
44 | |||
45 | /** |
||
46 | * @var \ArrayObject |
||
47 | */ |
||
48 | private $messages; |
||
49 | |||
50 | /** |
||
51 | * @var \ArrayIterator |
||
52 | */ |
||
53 | private $invalidRecipients; |
||
54 | |||
55 | /** |
||
56 | * @param string $applicationName |
||
57 | * @param CredentialsMapper $credentialsMapper |
||
58 | */ |
||
59 | public function __construct($applicationName, CredentialsMapper $credentialsMapper) |
||
67 | |||
68 | /** |
||
69 | * Returns path to application-based notification services credentials |
||
70 | * |
||
71 | * @return string |
||
72 | */ |
||
73 | public function getCredentialsFilePath() |
||
85 | |||
86 | /** |
||
87 | * @param string $filePath |
||
88 | * @return $this |
||
89 | */ |
||
90 | public function setCredentialsFilePath($filePath) |
||
95 | |||
96 | /** |
||
97 | * @return string |
||
98 | */ |
||
99 | public function getApplicationName() |
||
103 | |||
104 | /** |
||
105 | * @param string $applicationName |
||
106 | * @return $this |
||
107 | */ |
||
108 | public function setApplicationName($applicationName) |
||
113 | |||
114 | /** |
||
115 | * Gets an iterator from an ArrayObject instance |
||
116 | * |
||
117 | * @return \ArrayIterator |
||
118 | */ |
||
119 | public function getMessagesIterator() |
||
123 | |||
124 | /** |
||
125 | * Adds a message to collection |
||
126 | * |
||
127 | * @param MessageInterface $message |
||
128 | * @return $this |
||
129 | */ |
||
130 | public function addMessage(MessageInterface $message) |
||
136 | |||
137 | /** |
||
138 | * Removes the given message from collection |
||
139 | * |
||
140 | * @param MessageInterface $message |
||
141 | * @return $this |
||
142 | */ |
||
143 | public function unsetMessage(MessageInterface $message) |
||
149 | |||
150 | /** |
||
151 | * @return \ArrayIterator |
||
152 | */ |
||
153 | public function getInvalidRecipients() |
||
157 | |||
158 | /** |
||
159 | * Adds a invalid recipient to collection |
||
160 | * |
||
161 | * @param string $serviceName |
||
162 | * @param RecipientDevice|string $recipient |
||
163 | * @return $this |
||
164 | */ |
||
165 | public function addInvalidRecipient($serviceName, $recipient) |
||
184 | |||
185 | /** |
||
186 | * Returns the list of names of notification services available for the application |
||
187 | * |
||
188 | * @return array |
||
189 | */ |
||
190 | public function getInitializedServices() |
||
194 | |||
195 | /** |
||
196 | * Returns credentials for notification service |
||
197 | * |
||
198 | * @param string $serviceName |
||
199 | * @throws DomainException |
||
200 | * @return array |
||
201 | */ |
||
202 | public function getCredentialsByService($serviceName) |
||
225 | |||
226 | /** |
||
227 | * Load sender`s notification services credentials by application name |
||
228 | * |
||
229 | * @return $this |
||
230 | * @throws DomainException |
||
231 | */ |
||
232 | public function loadApplicationConfig() |
||
248 | } |
||
249 |