1 | <?php |
||
20 | class ServiceClientFactory |
||
21 | { |
||
22 | const ENVIRONMENT_PRODUCTION = 'production'; |
||
23 | const ENVIRONMENT_DEVELOPMENT = 'development'; |
||
24 | |||
25 | const PUSH_SERVICE = 'push'; |
||
26 | const FEEDBACK_SERVICE = 'feedback'; |
||
27 | |||
28 | /** |
||
29 | * Type of environment |
||
30 | * |
||
31 | * @var string |
||
32 | */ |
||
33 | private $environment; |
||
34 | |||
35 | /** |
||
36 | * @var ServiceCredentialsFactory |
||
37 | */ |
||
38 | private $credentialsFactory; |
||
39 | |||
40 | /** |
||
41 | * @var string |
||
42 | */ |
||
43 | private $serviceConfigPath; |
||
44 | |||
45 | /** |
||
46 | * Notification services connection config |
||
47 | * |
||
48 | * @var array |
||
49 | */ |
||
50 | private $serviceConfig; |
||
51 | |||
52 | /** |
||
53 | * @param ServiceCredentialsFactory $credentialsFactory |
||
54 | */ |
||
55 | public function __construct(ServiceCredentialsFactory $credentialsFactory) |
||
63 | |||
64 | /** |
||
65 | * @param bool $isDevelopment |
||
66 | * @return $this |
||
67 | */ |
||
68 | public function setDevelopmentMode($isDevelopment) |
||
75 | |||
76 | /** |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getEnvironment() |
||
83 | |||
84 | /** |
||
85 | * @param string $environment |
||
86 | * @return $this |
||
87 | */ |
||
88 | public function setEnvironment($environment) |
||
93 | |||
94 | /** |
||
95 | * @param string $serviceConfigPath |
||
96 | * @return $this |
||
97 | */ |
||
98 | public function setServiceConfigPath($serviceConfigPath) |
||
103 | |||
104 | /** |
||
105 | * @return $this |
||
106 | */ |
||
107 | public function setDefaultConfigPath() |
||
118 | |||
119 | /** |
||
120 | * @return array |
||
121 | */ |
||
122 | public function getServiceConfig() |
||
130 | |||
131 | /** |
||
132 | * @param array $serviceConfig |
||
133 | * @return $this |
||
134 | */ |
||
135 | public function setServiceConfig(array $serviceConfig) |
||
140 | |||
141 | /** |
||
142 | * Gets notification service url by service name |
||
143 | * |
||
144 | * @param string $serviceName |
||
145 | * @param bool $isFeedback |
||
146 | * @return array |
||
147 | */ |
||
148 | public function getServiceURL($serviceName, $isFeedback = false) |
||
166 | |||
167 | /** |
||
168 | * Creates client server connection by service name and sender credentials |
||
169 | * |
||
170 | * @param string $serviceName |
||
171 | * @param bool $isFeedback |
||
172 | * @return ServiceClientInterface |
||
173 | */ |
||
174 | public function createServiceClient($serviceName, $isFeedback = false) |
||
189 | |||
190 | /** |
||
191 | * Load notification services connection data |
||
192 | * |
||
193 | * @return $this |
||
194 | */ |
||
195 | public function loadServicesConfig() |
||
218 | } |
||
219 |