1 | <?php |
||
21 | class Application |
||
22 | { |
||
23 | const APPS_CREDENTIALS_FILENAME = 'applications_credentials.json'; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $credentialsFilePath; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $applicationName; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | private $config; |
||
39 | |||
40 | /** |
||
41 | * @var \ArrayObject |
||
42 | */ |
||
43 | private $messages; |
||
44 | |||
45 | /** |
||
46 | * @var \ArrayIterator |
||
47 | */ |
||
48 | private $invalidRecipients; |
||
49 | |||
50 | /** |
||
51 | * @param string $applicationName |
||
52 | */ |
||
53 | public function __construct($applicationName) |
||
60 | |||
61 | /** |
||
62 | * Returns path to application-based notification services credentials |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getCredentialsFilePath() |
||
81 | |||
82 | /** |
||
83 | * @param string $filePath |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function setCredentialsFilePath($filePath) |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | public function getApplicationName() |
||
99 | |||
100 | /** |
||
101 | * @param string $applicationName |
||
102 | * @return $this |
||
103 | */ |
||
104 | public function setApplicationName($applicationName) |
||
109 | |||
110 | /** |
||
111 | * Gets an iterator from an ArrayObject instance |
||
112 | * |
||
113 | * @return \ArrayIterator |
||
114 | */ |
||
115 | public function getMessagesIterator() |
||
119 | |||
120 | /** |
||
121 | * Adds a message to collection |
||
122 | * |
||
123 | * @param MessageInterface $message |
||
124 | * @return $this |
||
125 | */ |
||
126 | public function addMessage(MessageInterface $message) |
||
132 | |||
133 | /** |
||
134 | * Removes the given message from collection |
||
135 | * |
||
136 | * @param MessageInterface $message |
||
137 | * @return $this |
||
138 | */ |
||
139 | public function unsetMessage(MessageInterface $message) |
||
145 | |||
146 | /** |
||
147 | * @return \ArrayIterator |
||
148 | */ |
||
149 | public function getInvalidRecipients() |
||
153 | |||
154 | /** |
||
155 | * Adds a invalid recipient to collection |
||
156 | * |
||
157 | * @param string $serviceName |
||
158 | * @param RecipientDevice|string $recipient |
||
159 | * @return $this |
||
160 | */ |
||
161 | public function addInvalidRecipient($serviceName, $recipient) |
||
180 | |||
181 | /** |
||
182 | * Returns the list of names of notification services available for the application |
||
183 | * |
||
184 | * @return array |
||
185 | */ |
||
186 | public function getInitializedServices() |
||
190 | |||
191 | /** |
||
192 | * Returns credentials for notification service |
||
193 | * |
||
194 | * @param string $serviceName |
||
195 | * @throws DomainException |
||
196 | * @return string |
||
197 | */ |
||
198 | public function getCredentialsByService($serviceName) |
||
211 | |||
212 | /** |
||
213 | * Load sender`s notification services credentials by application name |
||
214 | * |
||
215 | * @return $this |
||
216 | * @throws DomainException |
||
217 | */ |
||
218 | public function loadApplicationConfig() |
||
234 | } |
||
235 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.