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 | * Gets notification service url by service name |
||
133 | * |
||
134 | * @param string $serviceName |
||
135 | * @param bool $isFeedback |
||
136 | * @return array |
||
137 | */ |
||
138 | public function getServiceURL($serviceName, $isFeedback = false) |
||
156 | |||
157 | /** |
||
158 | * Creates client server connection by service name and sender credentials |
||
159 | * |
||
160 | * @param string $serviceName |
||
161 | * @param bool $isFeedback |
||
162 | * @return ServiceClientInterface |
||
163 | */ |
||
164 | public function createServiceClient($serviceName, $isFeedback = false) |
||
179 | |||
180 | /** |
||
181 | * Load notification services connection data |
||
182 | * |
||
183 | * @return $this |
||
184 | */ |
||
185 | public function loadServicesConfig() |
||
208 | } |
||
209 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.