|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace PlaygroundCore; |
|
4
|
|
|
|
|
5
|
|
|
use Zend\Session\SessionManager; |
|
6
|
|
|
use Zend\Session\Config\SessionConfig; |
|
7
|
|
|
use Zend\Session\Container; |
|
8
|
|
|
use Zend\Validator\AbstractValidator; |
|
9
|
|
|
use Zend\EventManager\EventInterface; |
|
10
|
|
|
use Zend\ModuleManager\Feature\AutoloaderProviderInterface; |
|
11
|
|
|
use Zend\ModuleManager\Feature\BootstrapListenerInterface; |
|
12
|
|
|
use Zend\ModuleManager\Feature\ConfigProviderInterface; |
|
13
|
|
|
use Zend\ModuleManager\Feature\ServiceProviderInterface; |
|
14
|
|
|
use Zend\ModuleManager\Feature\ViewHelperProviderInterface; |
|
15
|
|
|
|
|
16
|
|
|
class Module implements |
|
17
|
|
|
AutoloaderProviderInterface, |
|
18
|
|
|
BootstrapListenerInterface, |
|
19
|
|
|
ConfigProviderInterface, |
|
20
|
|
|
ServiceProviderInterface, |
|
21
|
|
|
ViewHelperProviderInterface |
|
22
|
|
|
{ |
|
23
|
|
|
|
|
24
|
|
|
public function onBootstrap(EventInterface $e) |
|
|
|
|
|
|
25
|
|
|
{ |
|
26
|
|
|
$serviceManager = $e->getApplication()->getServiceManager(); |
|
|
|
|
|
|
27
|
|
|
$config = $e->getApplication()->getServiceManager()->get('config'); |
|
|
|
|
|
|
28
|
|
|
|
|
29
|
|
|
// Locale management |
|
30
|
|
|
$translator = $serviceManager->get('translator'); |
|
31
|
|
|
$defaultLocale = 'fr_FR'; |
|
32
|
|
|
|
|
33
|
|
|
// Gestion de la locale |
|
34
|
|
|
if (PHP_SAPI !== 'cli') { |
|
35
|
|
|
$config = $e->getApplication()->getServiceManager()->get('config'); |
|
|
|
|
|
|
36
|
|
|
if (isset($config['playgroundLocale'])) { |
|
37
|
|
|
$pgLocale = $config['playgroundLocale']; |
|
38
|
|
|
$defaultLocale = $pgLocale['default']; |
|
39
|
|
|
|
|
40
|
|
|
if (isset($pgLocale['strategies'])) { |
|
41
|
|
|
$pgstrat = $pgLocale['strategies']; |
|
42
|
|
|
|
|
43
|
|
|
// Is there a locale in the URL ? |
|
44
|
|
|
if (in_array('uri', $pgstrat)) { |
|
45
|
|
|
$path = $e->getRequest()->getUri()->getPath(); |
|
|
|
|
|
|
46
|
|
|
$parts = explode('/', trim($path, '/')); |
|
47
|
|
|
$localeCandidate = array_shift($parts); |
|
48
|
|
|
|
|
49
|
|
|
if (in_array($localeCandidate, $pgLocale['supported'])) { |
|
50
|
|
|
$locale = $localeCandidate; |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
// Is there a cookie for the locale ? |
|
55
|
|
|
if (empty($locale) && in_array('cookie', $pgstrat)) { |
|
56
|
|
|
$serviceManager->get('router')->setTranslator($translator); |
|
57
|
|
|
if ($serviceManager->get('router')->match($serviceManager->get('request')) && |
|
58
|
|
|
strpos($serviceManager->get('router')->match($serviceManager->get('request'))->getMatchedRouteName(), 'admin') !==false |
|
59
|
|
|
) { |
|
60
|
|
View Code Duplication |
if ($e->getRequest()->getCookie() && |
|
|
|
|
|
|
61
|
|
|
$e->getRequest()->getCookie()->offsetExists('pg_locale_back') |
|
|
|
|
|
|
62
|
|
|
) { |
|
63
|
|
|
$locale = $e->getRequest()->getCookie()->offsetGet('pg_locale_back'); |
|
|
|
|
|
|
64
|
|
|
} |
|
65
|
|
View Code Duplication |
} else { |
|
|
|
|
|
|
66
|
|
|
if ($e->getRequest()->getCookie() && |
|
|
|
|
|
|
67
|
|
|
$e->getRequest()->getCookie()->offsetExists('pg_locale_frontend') |
|
|
|
|
|
|
68
|
|
|
) { |
|
69
|
|
|
$locale = $e->getRequest()->getCookie()->offsetGet('pg_locale_frontend'); |
|
|
|
|
|
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
// Is there a locale in the request Header ? |
|
75
|
|
|
if (empty($locale) && in_array('header', $pgstrat)) { |
|
76
|
|
|
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
|
77
|
|
|
$localeCandidate = \Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); |
|
78
|
|
|
if (in_array($localeCandidate, $pgLocale['supported'])) { |
|
79
|
|
|
$locale = $localeCandidate; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
} |
|
84
|
|
|
// I take the default locale |
|
85
|
|
|
if (empty($locale)) { |
|
86
|
|
|
$locale = $defaultLocale; |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
// I take the default locale |
|
91
|
|
|
if (empty($locale)) { |
|
92
|
|
|
$locale = $defaultLocale; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
$translator->setLocale($locale); |
|
96
|
|
|
|
|
97
|
|
|
// Attach the translator to the router |
|
98
|
|
|
$e->getRouter()->setTranslator($translator); |
|
|
|
|
|
|
99
|
|
|
$e->getRouter()->setTranslatorTextDomain('playgrounddesign'); |
|
|
|
|
|
|
100
|
|
|
|
|
101
|
|
|
// Attach the translator to the plugins |
|
102
|
|
|
$translate = $serviceManager->get('viewhelpermanager')->get('translate'); |
|
103
|
|
|
$translate->getTranslator()->setLocale($locale); |
|
104
|
|
|
|
|
105
|
|
|
$options = $serviceManager->get('playgroundcore_module_options'); |
|
106
|
|
|
$options->setLocale($locale); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
// positionnement de la langue pour les traductions de date avec strftime |
|
110
|
|
|
setlocale(LC_TIME, "fr_FR", 'fr_FR.utf8', 'fra'); |
|
111
|
|
|
|
|
112
|
|
|
AbstractValidator::setDefaultTranslator($translator, 'playgroundcore'); |
|
113
|
|
|
|
|
114
|
|
|
/* |
|
115
|
|
|
* Entity translation based on Doctrine Gedmo library |
|
116
|
|
|
*/ |
|
117
|
|
|
$doctrine = $serviceManager->get('doctrine.entitymanager.orm_default'); |
|
118
|
|
|
$evm = $doctrine->getEventManager(); |
|
119
|
|
|
|
|
120
|
|
|
$translatableListener = new \Gedmo\Translatable\TranslatableListener(); |
|
121
|
|
|
$translatableListener->setDefaultLocale($defaultLocale); |
|
122
|
|
|
|
|
123
|
|
|
// If no translation is found, fallback to entity data |
|
124
|
|
|
$translatableListener->setTranslationFallback(true); |
|
125
|
|
|
|
|
126
|
|
|
// set Locale |
|
127
|
|
|
if (!empty($locale)) { |
|
128
|
|
|
$translatableListener->setTranslatableLocale($locale); |
|
129
|
|
|
} |
|
130
|
|
|
|
|
131
|
|
|
$evm->addEventSubscriber($translatableListener); |
|
132
|
|
|
|
|
133
|
|
|
/** |
|
134
|
|
|
* Adding a Filter to slugify a string (make it URL compliiant) |
|
135
|
|
|
*/ |
|
136
|
|
|
$filterChain = new \Zend\Filter\FilterChain(); |
|
137
|
|
|
$filterChain->getPluginManager()->setInvokableClass( |
|
138
|
|
|
'slugify', |
|
139
|
|
|
'PlaygroundCore\Filter\Slugify' |
|
140
|
|
|
); |
|
141
|
|
|
$filterChain->attach(new Filter\Slugify()); |
|
142
|
|
|
|
|
143
|
|
|
// Start the session container |
|
144
|
|
|
$sessionConfig = new SessionConfig(); |
|
145
|
|
|
$sessionConfig->setOptions($config['session']); |
|
146
|
|
|
$sessionManager = new SessionManager($sessionConfig); |
|
147
|
|
|
$sessionManager->start(); |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Optional: If you later want to use namespaces, you can already store the |
|
151
|
|
|
* Manager in the shared (static) Container (=namespace) field |
|
152
|
|
|
*/ |
|
153
|
|
|
\Zend\Session\Container::setDefaultManager($sessionManager); |
|
154
|
|
|
|
|
155
|
|
|
// Google Analytics : When the render event is triggered, we invoke the view helper to |
|
156
|
|
|
// render the javascript code. |
|
157
|
|
|
$e->getApplication()->getEventManager()->attach(\Zend\Mvc\MvcEvent::EVENT_RENDER, function (\Zend\Mvc\MvcEvent $e) use ($serviceManager) { |
|
|
|
|
|
|
158
|
|
|
$view = $serviceManager->get('ViewHelperManager'); |
|
159
|
|
|
$plugin = $view->get('googleAnalytics'); |
|
160
|
|
|
$plugin(); |
|
161
|
|
|
|
|
162
|
|
|
$pluginOG = $view->get('facebookOpengraph'); |
|
163
|
|
|
$pluginOG(); |
|
164
|
|
|
|
|
165
|
|
|
$pluginTC = $view->get('twitterCard'); |
|
166
|
|
|
$pluginTC(); |
|
167
|
|
|
}); |
|
168
|
|
|
|
|
169
|
|
|
|
|
170
|
|
|
if (PHP_SAPI !== 'cli') { |
|
171
|
|
|
$session = new Container('facebook'); |
|
172
|
|
|
$fb = $e->getRequest()->getPost()->get('signed_request'); |
|
|
|
|
|
|
173
|
|
|
if ($fb) { |
|
174
|
|
|
$signedReq = explode('.', $fb, 2); |
|
175
|
|
|
$payload = $signedReq[1]; |
|
176
|
|
|
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true); |
|
177
|
|
|
$session->offsetSet('signed_request', $data); |
|
178
|
|
|
|
|
179
|
|
|
// This fix exists only for safari on Windows : we need to redirect the user to the page outside of iframe |
|
180
|
|
|
// for the cookie to be accepted. Core just adds a 'redir_fb_page_id' var to alert controllers |
|
181
|
|
|
// that they need to send the user back to FB... |
|
182
|
|
|
|
|
183
|
|
|
if (!count($_COOKIE) > 0 && strpos($_SERVER['HTTP_USER_AGENT'], 'Safari')) { |
|
184
|
|
|
echo '<script type="text/javascript">' . |
|
185
|
|
|
'window.top.location.href = window.location.href+"?redir_fb_page_id='. $data["page"]["id"]. '";' . |
|
186
|
|
|
'</script>'; |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
// This fix exists only for IE6+, when this app is embedded into an iFrame : The P3P policy has to be set. |
|
190
|
|
|
$response = $e->getResponse(); |
|
|
|
|
|
|
191
|
|
|
if ($response instanceof \Zend\Http\Response && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strpos($_SERVER['HTTP_USER_AGENT'], 'rv:11.'))) { |
|
192
|
|
|
$response->getHeaders()->addHeaderLine('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'); |
|
193
|
|
|
} |
|
194
|
|
|
} |
|
195
|
|
|
} |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
public function getAutoloaderConfig() |
|
199
|
|
|
{ |
|
200
|
|
|
return array( |
|
201
|
|
|
'Zend\Loader\ClassMapAutoloader' => array( |
|
202
|
|
|
__DIR__ . '/../../autoload_classmap.php', |
|
203
|
|
|
), |
|
204
|
|
|
'Zend\Loader\StandardAutoloader' => array( |
|
205
|
|
|
'namespaces' => array( |
|
206
|
|
|
__NAMESPACE__ => __DIR__ . '/../../src/' . __NAMESPACE__, |
|
207
|
|
|
), |
|
208
|
|
|
), |
|
209
|
|
|
); |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
public function getConfig() |
|
213
|
|
|
{ |
|
214
|
|
|
return include __DIR__ . '/../../config/module.config.php'; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
public function getViewHelperConfig() |
|
218
|
|
|
{ |
|
219
|
|
|
return array( |
|
220
|
|
|
'factories' => array( |
|
221
|
|
|
'QgCKEditor' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
222
|
|
|
$config = $sm->getServiceLocator()->get('config'); |
|
|
|
|
|
|
223
|
|
|
$QuCk = new View\Helper\AdCKEditor($config['playgroundcore']['ckeditor']); |
|
224
|
|
|
|
|
225
|
|
|
return $QuCk; |
|
226
|
|
|
}, |
|
227
|
|
|
|
|
228
|
|
|
'googleAnalytics' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
229
|
|
|
$tracker = $sm->getServiceLocator()->get('google-analytics'); |
|
|
|
|
|
|
230
|
|
|
|
|
231
|
|
|
$helper = new View\Helper\GoogleAnalytics($tracker, $sm->getServiceLocator()->get('Request')); |
|
|
|
|
|
|
232
|
|
|
|
|
233
|
|
|
return $helper; |
|
234
|
|
|
}, |
|
235
|
|
|
|
|
236
|
|
|
'facebookOpengraph' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
237
|
|
|
$tracker = $sm->getServiceLocator()->get('facebook-opengraph'); |
|
|
|
|
|
|
238
|
|
|
|
|
239
|
|
|
$helper = new View\Helper\FacebookOpengraph($tracker, $sm->getServiceLocator()->get('Request')); |
|
|
|
|
|
|
240
|
|
|
|
|
241
|
|
|
return $helper; |
|
242
|
|
|
}, |
|
243
|
|
|
|
|
244
|
|
|
'twitterCard' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
245
|
|
|
$viewHelper = new View\Helper\TwitterCard(); |
|
246
|
|
|
$viewHelper->setConfig($sm->getServiceLocator()->get('twitter-card')); |
|
|
|
|
|
|
247
|
|
|
$viewHelper->setRequest($sm->getServiceLocator()->get('Request')); |
|
|
|
|
|
|
248
|
|
|
return $viewHelper; |
|
249
|
|
|
}, |
|
250
|
|
|
|
|
251
|
|
|
'switchLocaleWidget' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
252
|
|
|
$viewHelper = new View\Helper\SwitchLocaleWidget(); |
|
253
|
|
|
$viewHelper->setLocaleService($sm->getServiceLocator()->get('playgroundcore_locale_service')); |
|
|
|
|
|
|
254
|
|
|
$viewHelper->setWebsiteService($sm->getServiceLocator()->get('playgroundcore_website_service')); |
|
|
|
|
|
|
255
|
|
|
$viewHelper->setRouteMatch($sm->getServiceLocator()->get('application')->getMvcEvent()->getRouteMatch()); |
|
|
|
|
|
|
256
|
|
|
return $viewHelper; |
|
257
|
|
|
}, |
|
258
|
|
|
), |
|
259
|
|
|
); |
|
260
|
|
|
} |
|
261
|
|
|
|
|
262
|
|
|
public function getServiceConfig() |
|
263
|
|
|
{ |
|
264
|
|
|
return array( |
|
265
|
|
|
|
|
266
|
|
|
'aliases' => array( |
|
267
|
|
|
'playgroundcore_doctrine_em' => 'doctrine.entitymanager.orm_default', |
|
268
|
|
|
'google-analytics' => 'PlaygroundCore\Analytics\Tracker', |
|
269
|
|
|
'facebook-opengraph' => 'PlaygroundCore\Opengraph\Tracker', |
|
270
|
|
|
'twitter-card' => 'PlaygroundCore\TwitterCard\Config', |
|
271
|
|
|
'twilio' => 'playgroundcore_twilio', |
|
272
|
|
|
'ffmpeg' => 'playgroundcore_phpvideotoolkit' |
|
273
|
|
|
), |
|
274
|
|
|
|
|
275
|
|
|
'shared' => array( |
|
276
|
|
|
'playgroundcore_message' => false, |
|
277
|
|
|
// don't want this service to be a singleton. I have to reset the ffmpeg parameters for each call. |
|
278
|
|
|
'playgroundcore_ffmpeg_service' => false |
|
279
|
|
|
), |
|
280
|
|
|
|
|
281
|
|
|
'invokables' => array( |
|
282
|
|
|
'Zend\Session\SessionManager' => 'Zend\Session\SessionManager', |
|
283
|
|
|
'playgroundcore_message' => 'PlaygroundCore\Mail\Service\Message', |
|
284
|
|
|
'playgroundcore_cron_service' => 'PlaygroundCore\Service\Cron', |
|
285
|
|
|
'playgroundcore_shortenurl_service' => 'PlaygroundCore\Service\ShortenUrl', |
|
286
|
|
|
'playgroundcore_website_service' => 'PlaygroundCore\Service\Website', |
|
287
|
|
|
'playgroundcore_locale_service' => 'PlaygroundCore\Service\Locale', |
|
288
|
|
|
'playgroundcore_formgen_service' => 'PlaygroundCore\Service\Formgen', |
|
289
|
|
|
'playgroundcore_image_service' => 'PlaygroundCore\Service\Image', |
|
290
|
|
|
'playgroundcore_ffmpeg_service' => 'PlaygroundCore\Service\Ffmpeg', |
|
291
|
|
|
), |
|
292
|
|
|
'factories' => array( |
|
293
|
|
|
'playgroundcore_module_options' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
294
|
|
|
$config = $sm->get('Configuration'); |
|
295
|
|
|
|
|
296
|
|
|
return new Options\ModuleOptions(isset($config['playgroundcore']) ? $config['playgroundcore'] : array()); |
|
297
|
|
|
}, |
|
298
|
|
|
|
|
299
|
|
|
'playgroundcore_formgen_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
300
|
|
|
return new Mapper\Formgen($sm->get('playgroundcore_doctrine_em'), $sm->get('playgroundcore_module_options')); |
|
|
|
|
|
|
301
|
|
|
}, |
|
302
|
|
|
|
|
303
|
|
|
'playgroundcore_website_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
304
|
|
|
|
|
305
|
|
|
return new Mapper\Website($sm->get('playgroundcore_doctrine_em'), $sm->get('playgroundcore_module_options')); |
|
|
|
|
|
|
306
|
|
|
}, |
|
307
|
|
|
|
|
308
|
|
|
'playgroundcore_locale_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
309
|
|
|
return new Mapper\Locale($sm->get('playgroundcore_doctrine_em'), $sm->get('playgroundcore_module_options')); |
|
|
|
|
|
|
310
|
|
|
}, |
|
311
|
|
|
|
|
312
|
|
|
'playgroundcore_twilio' => 'PlaygroundCore\Service\Factory\TwilioServiceFactory', |
|
313
|
|
|
'playgroundcore_phpvideotoolkit' => 'PlaygroundCore\Service\Factory\PhpvideotoolkitServiceFactory', |
|
314
|
|
|
'playgroundcore_transport' => 'PlaygroundCore\Mail\Transport\Service\TransportFactory', |
|
315
|
|
|
'PlaygroundCore\Analytics\Tracker' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
316
|
|
|
$config = $sm->get('config'); |
|
317
|
|
|
$config = isset($config['playgroundcore']) ? $config['playgroundcore']['googleAnalytics'] : array('id' => 'UA-XXXXXXXX-X'); |
|
318
|
|
|
|
|
319
|
|
|
$tracker = new Analytics\Tracker($config['id']); |
|
320
|
|
|
|
|
321
|
|
|
if (isset($config['custom_vars'])) { |
|
322
|
|
|
foreach ($config['custom_vars'] as $customVar) { |
|
323
|
|
|
$customVarId = $customVar['id']; |
|
324
|
|
|
$customVarName = $customVar['name']; |
|
325
|
|
|
$customVarValue = $customVar['value']; |
|
326
|
|
|
$customVarOptScope = $customVar['optScope']; |
|
327
|
|
|
$customVar = new Analytics\CustomVar($customVarId, $customVarName, $customVarValue, $customVarOptScope); |
|
328
|
|
|
$tracker->addCustomVar($customVar); |
|
329
|
|
|
} |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
|
if (isset($config['domain_name'])) { |
|
333
|
|
|
$tracker->setDomainName($config['domain_name']); |
|
334
|
|
|
} |
|
335
|
|
|
|
|
336
|
|
|
if (isset($config['allow_linker'])) { |
|
337
|
|
|
$tracker->setAllowLinker($config['allow_linker']); |
|
338
|
|
|
} |
|
339
|
|
|
|
|
340
|
|
|
if (isset($config['allow_hash'])) { |
|
341
|
|
|
$tracker->setAllowHash($config['allow_hash']); |
|
342
|
|
|
} |
|
343
|
|
|
|
|
344
|
|
|
return $tracker; |
|
345
|
|
|
}, |
|
346
|
|
|
'PlaygroundCore\Opengraph\Tracker' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
347
|
|
|
$config = $sm->get('config'); |
|
348
|
|
|
$config = isset($config['playgroundcore']['facebookOpengraph']) ? $config['playgroundcore']['facebookOpengraph'] : array('appId' => ''); |
|
349
|
|
|
|
|
350
|
|
|
$tracker = new Opengraph\Tracker($config['appId']); |
|
351
|
|
|
|
|
352
|
|
|
if (isset($config['enable'])) { |
|
353
|
|
|
$tracker->setEnableOpengraph($config['enable']); |
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
|
if (isset($config['tags'])) { |
|
357
|
|
|
foreach ($config['tags'] as $type => $value) { |
|
358
|
|
|
$tag = new Opengraph\Tag($type, $value); |
|
359
|
|
|
$tracker->addTag($tag); |
|
360
|
|
|
} |
|
361
|
|
|
} |
|
362
|
|
|
|
|
363
|
|
|
return $tracker; |
|
364
|
|
|
}, |
|
365
|
|
|
'PlaygroundCore\TwitterCard\Config' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
366
|
|
|
$config = $sm->get('config'); |
|
367
|
|
|
$config = isset($config['playgroundcore']['twitterCard']) ? $config['playgroundcore']['twitterCard'] : array(); |
|
368
|
|
|
return new TwitterCard\Config($config); |
|
369
|
|
|
}, |
|
370
|
|
|
), |
|
371
|
|
|
); |
|
372
|
|
|
} |
|
373
|
|
|
} |
|
374
|
|
|
|
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: