This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * dependency Core |
||
4 | * @author gbesson |
||
5 | * |
||
6 | */ |
||
7 | namespace PlaygroundGame; |
||
8 | |||
9 | use Zend\ModuleManager\ModuleManager; |
||
10 | use Zend\Mvc\ModuleRouteListener; |
||
11 | use Zend\Mvc\MvcEvent; |
||
12 | use Zend\Validator\AbstractValidator; |
||
13 | use Zend\Db\Sql\Sql; |
||
14 | use Zend\Db\Adapter\Adapter; |
||
15 | |||
16 | class Module |
||
17 | { |
||
18 | public function init(ModuleManager $manager) |
||
19 | { |
||
20 | $eventManager = $manager->getEventManager(); |
||
21 | |||
22 | /* |
||
23 | * This event change the config before it's cached |
||
24 | * The change will apply to 'template_path_stack' |
||
25 | * This config take part in the Playground Theme Management |
||
26 | */ |
||
27 | $eventManager->attach(\Zend\ModuleManager\ModuleEvent::EVENT_MERGE_CONFIG, array($this, 'onMergeConfig'), 50); |
||
28 | } |
||
29 | |||
30 | /** |
||
31 | * This method is called only when the config is not cached. |
||
32 | * @param \Zend\ModuleManager\ModuleEvent $e |
||
33 | */ |
||
34 | public function onMergeConfig(\Zend\ModuleManager\ModuleEvent $e) |
||
35 | { |
||
36 | $config = $e->getConfigListener()->getMergedConfig(false); |
||
37 | |||
38 | if (isset($config['design']) && isset($config['design']['frontend'])) { |
||
39 | $parentTheme = array($config['design']['frontend']['package'], $config['design']['frontend']['theme']); |
||
40 | } else { |
||
41 | $parentTheme = array('playground', 'base'); |
||
42 | } |
||
43 | |||
44 | // If custom games need a specific route. I create these routes |
||
45 | if (PHP_SAPI !== 'cli') { |
||
46 | $configDatabaseDoctrine = $config['doctrine']['connection']['orm_default']['params']; |
||
47 | $configDatabase = array('driver' => 'Mysqli', |
||
48 | 'database' => $configDatabaseDoctrine['dbname'], |
||
49 | 'username' => $configDatabaseDoctrine['user'], |
||
50 | 'password' => $configDatabaseDoctrine['password'], |
||
51 | 'hostname' => $configDatabaseDoctrine['host']); |
||
52 | |||
53 | if (!empty($configDatabaseDoctrine['port'])) { |
||
54 | $configDatabase['port'] = $configDatabaseDoctrine['port']; |
||
55 | } |
||
56 | if (!empty($configDatabaseDoctrine['charset'])) { |
||
57 | $configDatabase['charset'] = $configDatabaseDoctrine['charset']; |
||
58 | } |
||
59 | |||
60 | $adapter = new Adapter($configDatabase); |
||
61 | $sql = new Sql($adapter); |
||
62 | |||
63 | // ****************************************** |
||
64 | // Check if games with specific domains have been configured |
||
65 | // ****************************************** |
||
66 | $select = $sql->select(); |
||
67 | $select->from('game'); |
||
68 | $select->where(array('active' => 1, 'domain IS NOT NULL', "domain != ''")); |
||
69 | $statement = $sql->prepareStatementForSqlObject($select); |
||
70 | $results = $statement->execute(); |
||
71 | foreach ($results as $result) { |
||
72 | $config['custom_games'][$result['identifier']] = [ |
||
73 | 'url' => $result['domain'], |
||
74 | 'classType' => $result['class_type'] |
||
75 | ]; |
||
76 | } |
||
77 | |||
78 | if (isset($config['custom_games'])) { |
||
79 | foreach ($config['custom_games'] as $k => $v) { |
||
80 | // add custom language directory |
||
81 | $config['translator']['translation_file_patterns'][] = array( |
||
82 | 'type' => 'phpArray', |
||
83 | 'base_dir' => __DIR__ .'/../../../../design/frontend/'.$parentTheme[0]. |
||
84 | '/'.$parentTheme[1].'/custom/'.$k.'/language', |
||
85 | 'pattern' => '%s.php', |
||
86 | 'text_domain' => $k, |
||
87 | ); |
||
88 | |||
89 | // create routes |
||
90 | if (isset($v['url'])) { |
||
91 | if (!is_array($v['url'])) { |
||
92 | $v['url'] = array($v['url']); |
||
93 | } |
||
94 | foreach ($v['url'] as $url) { |
||
95 | // I take the url model of the game type |
||
96 | if (isset($config['router']['routes']['frontend']['child_routes'][$v['classType']])) { |
||
97 | $routeModel = $config['router']['routes']['frontend']['child_routes'][$v['classType']]; |
||
98 | |||
99 | // Changing the root of the route |
||
100 | $routeModel['options']['route'] = '/'; |
||
101 | |||
102 | // and removing the trailing slash for each subsequent route |
||
103 | foreach ($routeModel['child_routes'] as $id => $ar) { |
||
104 | if (isset($routeModel['child_routes'][$id]['options']['route'])) { |
||
105 | $routeModel['child_routes'][$id]['options']['route'] = ltrim( |
||
106 | $ar['options']['route'], |
||
107 | '/' |
||
108 | ); |
||
109 | } |
||
110 | } |
||
111 | |||
112 | // then create the hostname route + appending the model updated |
||
113 | $config['router']['routes']['frontend.'.$url] = array( |
||
114 | 'type' => 'Zend\Router\Http\Hostname', |
||
115 | 'options' => array( |
||
116 | 'route' => $url, |
||
117 | 'defaults' => array( |
||
118 | 'id' => $k, |
||
119 | ) |
||
120 | ), |
||
121 | 'may_terminate' => true |
||
122 | ); |
||
123 | $config['router']['routes']['frontend.'.$url]['child_routes'][$v['classType']] = $routeModel; |
||
124 | // print_r($config['router']['routes']['frontend.'.$url]); |
||
125 | // die('o'); |
||
126 | $coreLayoutModel = isset($config['core_layout']['frontend'])? |
||
127 | $config['core_layout']['frontend']: |
||
128 | []; |
||
129 | $config['core_layout']['frontend.'.$url] = $coreLayoutModel; |
||
130 | } |
||
131 | } |
||
132 | } |
||
133 | } |
||
134 | } |
||
135 | } |
||
136 | |||
137 | $e->getConfigListener()->setMergedConfig($config); |
||
138 | } |
||
139 | |||
140 | public function onBootstrap(MvcEvent $e) |
||
141 | { |
||
142 | $serviceManager = $e->getApplication()->getServiceManager(); |
||
143 | |||
144 | $options = $serviceManager->get('playgroundcore_module_options'); |
||
145 | $locale = $options->getLocale(); |
||
146 | $translator = $serviceManager->get('MvcTranslator'); |
||
147 | if (!empty($locale)) { |
||
148 | //translator |
||
149 | $translator->setLocale($locale); |
||
150 | |||
151 | // plugins |
||
152 | $translate = $serviceManager->get('ViewHelperManager')->get('translate'); |
||
153 | $translate->getTranslator()->setLocale($locale); |
||
154 | } |
||
155 | |||
156 | AbstractValidator::setDefaultTranslator($translator, 'playgroundcore'); |
||
157 | |||
158 | $eventManager = $e->getApplication()->getEventManager(); |
||
159 | $moduleRouteListener = new ModuleRouteListener(); |
||
160 | $moduleRouteListener->attach($eventManager); |
||
161 | |||
162 | // If PlaygroundCms is installed, I can add my own dynareas to benefit from this feature |
||
163 | $e->getApplication()->getEventManager()->getSharedManager()->attach( |
||
164 | 'Zend\Mvc\Application', |
||
165 | 'getDynareas', |
||
166 | array($this, 'updateDynareas') |
||
167 | ); |
||
168 | |||
169 | // I can post cron tasks to be scheduled by the core cron service |
||
170 | $e->getApplication()->getEventManager()->getSharedManager()->attach( |
||
171 | 'Zend\Mvc\Application', |
||
172 | 'getCronjobs', |
||
173 | array($this, 'addCronjob') |
||
174 | ); |
||
175 | |||
176 | // If PlaygroundCms is installed, I can add game categories |
||
177 | $e->getApplication()->getEventManager()->getSharedManager()->attach( |
||
178 | 'Zend\Mvc\Application', |
||
179 | 'getCmsCategories', |
||
180 | array($this, 'populateCmsCategories') |
||
181 | ); |
||
182 | |||
183 | // If cron is called, the $e->getRequest()->getPost() produces an error so I protect it with |
||
184 | // this test |
||
185 | if ((get_class($e->getRequest()) == 'Zend\Console\Request')) { |
||
186 | return; |
||
187 | } |
||
188 | |||
189 | /** |
||
190 | * This listener gives the possibility to select the layout on module / controller / action level |
||
191 | * This is triggered after the PlaygroundDesign one so that it's the last triggered for games. |
||
192 | */ |
||
193 | $e->getApplication()->getEventManager()->getSharedManager()->attach( |
||
194 | 'Zend\Mvc\Controller\AbstractActionController', |
||
195 | 'dispatch', |
||
196 | function (MvcEvent $e) { |
||
197 | $config = $e->getApplication()->getServiceManager()->get('config'); |
||
198 | if (isset($config['core_layout'])) { |
||
199 | $controller = $e->getTarget(); |
||
200 | $controllerClass = get_class($controller); |
||
201 | $moduleName = strtolower(substr($controllerClass, 0, strpos($controllerClass, '\\'))); |
||
202 | $match = $e->getRouteMatch(); |
||
203 | $routeName = $match->getMatchedRouteName(); |
||
204 | $areaName = (strpos($routeName, '/'))? |
||
205 | substr($routeName, 0, strpos($routeName, '/')): |
||
206 | $routeName; |
||
207 | $areaName = (strpos($areaName, '.'))?substr($areaName, 0, strpos($areaName, '.')):$areaName; |
||
208 | $areaName = ($areaName == 'frontend' || $areaName == 'admin')?$areaName:'frontend'; |
||
209 | $controllerName = $match->getParam('controller', 'not-found'); |
||
210 | $actionName = $match->getParam('action', 'not-found'); |
||
211 | $slug = $match->getParam('id', ''); |
||
212 | $viewModel = $e->getViewModel(); |
||
213 | |||
214 | /** |
||
215 | * Assign the correct layout |
||
216 | */ |
||
217 | if (!empty($slug)) { |
||
218 | if (isset($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['controllers'][$controllerName]['actions'][$actionName]['layout'])) { |
||
219 | $controller->layout($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['controllers'][$controllerName]['actions'][$actionName]['layout']); |
||
220 | } elseif (isset($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['controllers'][$controllerName]['layout'])) { |
||
221 | $controller->layout($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['controllers'][$controllerName]['layout']); |
||
222 | } elseif (isset($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['layout'])) { |
||
223 | $controller->layout($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['layout']); |
||
224 | } elseif (isset($config['custom_games'][$slug]['core_layout'][$areaName]['layout'])) { |
||
225 | $controller->layout($config['custom_games'][$slug]['core_layout'][$areaName]['layout']); |
||
226 | } |
||
227 | |||
228 | // the area needs to be updated if I'm in a custom game for frontendUrl to work |
||
229 | if (isset($config['custom_games'][$slug])) { |
||
230 | $url = (is_array($config['custom_games'][$slug]['url']))? |
||
231 | $config['custom_games'][$slug]['url']: |
||
232 | array($config['custom_games'][$slug]['url']); |
||
233 | $from = strtolower($e->getRequest()->getUri()->getHost()); |
||
0 ignored issues
–
show
|
|||
234 | $areaName = ($areaName === 'frontend' && in_array($from, $url))?$areaName.'.'.$from:$areaName; |
||
235 | } |
||
236 | // I add this area param so that it can be used by Controller plugin frontendUrl |
||
237 | // and View helper frontendUrl |
||
238 | $match->setParam('area', $areaName); |
||
239 | /** |
||
240 | * Create variables attached to layout containing path views |
||
241 | * cascading assignment is managed |
||
242 | */ |
||
243 | if (isset($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['children_views'])) { |
||
244 | foreach ($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['children_views'] as $k => $v) { |
||
245 | $viewModel->$k = $v; |
||
246 | } |
||
247 | } |
||
248 | if (isset($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['controllers'][$controllerName]['children_views'])) { |
||
249 | View Code Duplication | foreach ($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['controllers'][$controllerName]['children_views'] as $k => $v) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
250 | $viewModel->$k = $v; |
||
251 | } |
||
252 | } |
||
253 | if (isset($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['controllers'][$controllerName]['actions'][$actionName]['children_views'])) { |
||
254 | View Code Duplication | foreach ($config['custom_games'][$slug]['core_layout'][$areaName]['modules'][$moduleName]['controllers'][$controllerName]['actions'][$actionName]['children_views'] as $k => $v) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
255 | $viewModel->$k = $v; |
||
256 | } |
||
257 | } |
||
258 | } |
||
259 | } |
||
260 | }, |
||
261 | 10 |
||
262 | ); |
||
263 | } |
||
264 | |||
265 | /** |
||
266 | * This method get the games and add them as Dynareas to PlaygroundCms |
||
267 | * so that blocks can be dynamically added to the games. |
||
268 | * |
||
269 | * @param MvcEvent $e |
||
270 | * @return array |
||
271 | */ |
||
272 | public function updateDynareas(\Zend\EventManager\Event $e) |
||
273 | { |
||
274 | $dynareas = $e->getParam('dynareas'); |
||
275 | |||
276 | $gameService = $e->getTarget()->getServiceManager()->get('playgroundgame_game_service'); |
||
277 | |||
278 | $games = $gameService->getActiveGames(false); |
||
279 | |||
280 | foreach ($games as $game) { |
||
281 | $array = array( |
||
282 | 'game'.$game->getId()=> array( |
||
283 | 'title' => $game->getTitle(), |
||
284 | 'description' => $game->getClassType(), |
||
285 | 'location' => 'pages du jeu' |
||
286 | ) |
||
287 | ); |
||
288 | $dynareas = array_merge($dynareas, $array); |
||
289 | } |
||
290 | |||
291 | return $dynareas; |
||
292 | } |
||
293 | |||
294 | /** |
||
295 | * This method add the games to the cms categories of pages |
||
296 | * not that satisfied neither |
||
297 | * |
||
298 | * @param EventManager $e |
||
299 | * @return array |
||
300 | */ |
||
301 | public function populateCmsCategories(\Zend\EventManager\Event $e) |
||
302 | { |
||
303 | $catsArray = $e->getParam('categories'); |
||
304 | |||
305 | $gameService = $e->getTarget()->getServiceManager()->get('playgroundgame_game_service'); |
||
306 | $games = $gameService->getActiveGames(false); |
||
307 | |||
308 | foreach ($games as $game) { |
||
309 | $catsArray[$game->getIdentifier()] = 'Pg Game - '.$game->getIdentifier(); |
||
310 | } |
||
311 | |||
312 | return $catsArray; |
||
313 | } |
||
314 | |||
315 | /** |
||
316 | * This method get the cron config for this module an add them to the listener |
||
317 | * |
||
318 | * @param MvcEvent $e |
||
319 | * @return array |
||
320 | */ |
||
321 | public function addCronjob(\Zend\EventManager\Event $e) |
||
322 | { |
||
323 | $cronjobs = $e->getParam('cronjobs'); |
||
324 | |||
325 | // $cronjobs['adfagame_email'] = array( |
||
326 | // 'frequency' => '*/15 * * * *', |
||
327 | // 'callback' => '\PlaygroundGame\Service\Cron::cronMail', |
||
328 | // 'args' => array('bar', 'baz'), |
||
329 | // ); |
||
330 | |||
331 | // // tous les jours à 5:00 AM |
||
332 | // $cronjobs['adfagame_instantwin_email'] = array( |
||
333 | // 'frequency' => '* 5 * * *', |
||
334 | // 'callback' => '\PlaygroundGame\Service\Cron::instantWinEmail', |
||
335 | // 'args' => array(), |
||
336 | // ); |
||
337 | |||
338 | return $cronjobs; |
||
339 | } |
||
340 | |||
341 | public function getConfig() |
||
342 | { |
||
343 | return include __DIR__ .'/../config/module.config.php'; |
||
344 | } |
||
345 | |||
346 | /** |
||
347 | * @return array |
||
348 | */ |
||
349 | public function getViewHelperConfig() |
||
350 | { |
||
351 | return array( |
||
352 | 'factories' => [ |
||
353 | 'playgroundPrizeCategory' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
354 | $viewHelper = new View\Helper\PrizeCategory; |
||
355 | $viewHelper->setPrizeCategoryService($sm->get('playgroundgame_prizecategory_service')); |
||
356 | |||
357 | return $viewHelper; |
||
358 | }, |
||
359 | 'postvoteShareEvents' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
360 | $service = $sm->get('playgroundgame_postvote_service'); |
||
361 | |||
362 | return new \PlaygroundGame\View\Helper\PostvoteShareEvents($service); |
||
363 | }, |
||
364 | \PlaygroundGame\View\Helper\GameWidget::class => \PlaygroundGame\View\Helper\GameWidgetFactory::class, |
||
365 | \PlaygroundGame\View\Helper\GamesWidget::class => \PlaygroundGame\View\Helper\GamesWidgetFactory::class, |
||
366 | \PlaygroundGame\View\Helper\NextGamesWidget::class => \PlaygroundGame\View\Helper\NextGamesWidgetFactory::class, |
||
367 | ], |
||
368 | 'aliases' => [ |
||
369 | 'gameWidget' => \PlaygroundGame\View\Helper\GameWidget::class, |
||
370 | 'gamesWidget' => \PlaygroundGame\View\Helper\GamesWidget::class, |
||
371 | 'nextGamesWidget' => \PlaygroundGame\View\Helper\NextGamesWidget::class, |
||
372 | ] |
||
373 | ); |
||
374 | } |
||
375 | |||
376 | public function getServiceConfig() |
||
377 | { |
||
378 | return array( |
||
379 | 'factories' => array( |
||
380 | 'playgroundgame_module_options' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
381 | $config = $sm->get('Configuration'); |
||
382 | |||
383 | return new Options\ModuleOptions( |
||
384 | isset($config['playgroundgame'])?$config['playgroundgame']:array() |
||
385 | ); |
||
386 | }, |
||
387 | |||
388 | 'playgroundgame_game_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
389 | $mapper = new \PlaygroundGame\Mapper\Game( |
||
390 | $sm->get('doctrine.entitymanager.orm_default'), |
||
391 | $sm->get('playgroundgame_module_options'), |
||
392 | $sm |
||
393 | ); |
||
394 | |||
395 | return $mapper; |
||
396 | }, |
||
397 | |||
398 | 'playgroundgame_playerform_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
399 | $mapper = new \PlaygroundGame\Mapper\PlayerForm( |
||
400 | $sm->get('doctrine.entitymanager.orm_default'), |
||
401 | $sm->get('playgroundgame_module_options'), |
||
402 | $sm |
||
403 | ); |
||
404 | |||
405 | return $mapper; |
||
406 | }, |
||
407 | |||
408 | 'playgroundgame_lottery_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
409 | $mapper = new \PlaygroundGame\Mapper\Lottery( |
||
410 | $sm->get('doctrine.entitymanager.orm_default'), |
||
411 | $sm->get('playgroundgame_module_options'), |
||
412 | $sm |
||
413 | ); |
||
414 | |||
415 | return $mapper; |
||
416 | }, |
||
417 | |||
418 | 'playgroundgame_instantwin_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
419 | $mapper = new \PlaygroundGame\Mapper\InstantWin( |
||
420 | $sm->get('doctrine.entitymanager.orm_default'), |
||
421 | $sm->get('playgroundgame_module_options'), |
||
422 | $sm |
||
423 | ); |
||
424 | |||
425 | return $mapper; |
||
426 | }, |
||
427 | |||
428 | 'playgroundgame_instantwinoccurrence_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
429 | $mapper = new \PlaygroundGame\Mapper\InstantWinOccurrence( |
||
430 | $sm->get('doctrine.entitymanager.orm_default'), |
||
431 | $sm->get('playgroundgame_module_options'), |
||
432 | $sm |
||
433 | ); |
||
434 | |||
435 | return $mapper; |
||
436 | }, |
||
437 | |||
438 | 'playgroundgame_quiz_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
439 | $mapper = new \PlaygroundGame\Mapper\Quiz( |
||
440 | $sm->get('doctrine.entitymanager.orm_default'), |
||
441 | $sm->get('playgroundgame_module_options'), |
||
442 | $sm |
||
443 | ); |
||
444 | |||
445 | return $mapper; |
||
446 | }, |
||
447 | |||
448 | 'playgroundgame_quizquestion_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
449 | $mapper = new \PlaygroundGame\Mapper\QuizQuestion( |
||
450 | $sm->get('doctrine.entitymanager.orm_default'), |
||
451 | $sm->get('playgroundgame_module_options'), |
||
452 | $sm |
||
453 | ); |
||
454 | |||
455 | return $mapper; |
||
456 | }, |
||
457 | |||
458 | 'playgroundgame_quizanswer_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
459 | $mapper = new \PlaygroundGame\Mapper\QuizAnswer( |
||
460 | $sm->get('doctrine.entitymanager.orm_default'), |
||
461 | $sm->get('playgroundgame_module_options'), |
||
462 | $sm |
||
463 | ); |
||
464 | |||
465 | return $mapper; |
||
466 | }, |
||
467 | |||
468 | 'playgroundgame_quizreply_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
469 | $mapper = new \PlaygroundGame\Mapper\QuizReply( |
||
470 | $sm->get('doctrine.entitymanager.orm_default'), |
||
471 | $sm->get('playgroundgame_module_options'), |
||
472 | $sm |
||
473 | ); |
||
474 | |||
475 | return $mapper; |
||
476 | }, |
||
477 | |||
478 | 'playgroundgame_quizreplyanswer_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
479 | $mapper = new \PlaygroundGame\Mapper\QuizReplyAnswer( |
||
480 | $sm->get('doctrine.entitymanager.orm_default'), |
||
481 | $sm->get('playgroundgame_module_options'), |
||
482 | $sm |
||
483 | ); |
||
484 | |||
485 | return $mapper; |
||
486 | }, |
||
487 | |||
488 | 'playgroundgame_entry_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
489 | $mapper = new \PlaygroundGame\Mapper\Entry( |
||
490 | $sm->get('doctrine.entitymanager.orm_default'), |
||
491 | $sm->get('playgroundgame_module_options'), |
||
492 | $sm |
||
493 | ); |
||
494 | |||
495 | return $mapper; |
||
496 | }, |
||
497 | |||
498 | 'playgroundgame_postvote_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
499 | $mapper = new \PlaygroundGame\Mapper\PostVote( |
||
500 | $sm->get('doctrine.entitymanager.orm_default'), |
||
501 | $sm->get('playgroundgame_module_options'), |
||
502 | $sm |
||
503 | ); |
||
504 | |||
505 | return $mapper; |
||
506 | }, |
||
507 | |||
508 | 'playgroundgame_postvoteform_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
509 | $mapper = new \PlaygroundGame\Mapper\PostVoteForm( |
||
510 | $sm->get('doctrine.entitymanager.orm_default'), |
||
511 | $sm->get('playgroundgame_module_options'), |
||
512 | $sm |
||
513 | ); |
||
514 | |||
515 | return $mapper; |
||
516 | }, |
||
517 | |||
518 | 'playgroundgame_postvotepost_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
519 | $mapper = new \PlaygroundGame\Mapper\PostVotePost( |
||
520 | $sm->get('doctrine.entitymanager.orm_default'), |
||
521 | $sm->get('playgroundgame_module_options'), |
||
522 | $sm |
||
523 | ); |
||
524 | |||
525 | return $mapper; |
||
526 | }, |
||
527 | |||
528 | 'playgroundgame_postvotepostelement_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
529 | $mapper = new \PlaygroundGame\Mapper\PostVotePostElement( |
||
530 | $sm->get('doctrine.entitymanager.orm_default'), |
||
531 | $sm->get('playgroundgame_module_options'), |
||
532 | $sm |
||
533 | ); |
||
534 | |||
535 | return $mapper; |
||
536 | }, |
||
537 | |||
538 | 'playgroundgame_postvotevote_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
539 | $mapper = new \PlaygroundGame\Mapper\PostVoteVote( |
||
540 | $sm->get('doctrine.entitymanager.orm_default'), |
||
541 | $sm->get('playgroundgame_module_options'), |
||
542 | $sm |
||
543 | ); |
||
544 | |||
545 | return $mapper; |
||
546 | }, |
||
547 | |||
548 | 'playgroundgame_postvotecomment_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
549 | $mapper = new \PlaygroundGame\Mapper\PostVoteComment( |
||
550 | $sm->get('doctrine.entitymanager.orm_default'), |
||
551 | $sm->get('playgroundgame_module_options'), |
||
552 | $sm |
||
553 | ); |
||
554 | |||
555 | return $mapper; |
||
556 | }, |
||
557 | |||
558 | 'playgroundgame_postvoteshare_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
559 | $mapper = new \PlaygroundGame\Mapper\PostVoteShare( |
||
560 | $sm->get('doctrine.entitymanager.orm_default'), |
||
561 | $sm->get('playgroundgame_module_options'), |
||
562 | $sm |
||
563 | ); |
||
564 | |||
565 | return $mapper; |
||
566 | }, |
||
567 | |||
568 | 'playgroundgame_postvoteview_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
569 | $mapper = new \PlaygroundGame\Mapper\PostVoteView( |
||
570 | $sm->get('doctrine.entitymanager.orm_default'), |
||
571 | $sm->get('playgroundgame_module_options'), |
||
572 | $sm |
||
573 | ); |
||
574 | |||
575 | return $mapper; |
||
576 | }, |
||
577 | |||
578 | 'playgroundgame_prize_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
579 | $mapper = new \PlaygroundGame\Mapper\Prize( |
||
580 | $sm->get('doctrine.entitymanager.orm_default'), |
||
581 | $sm->get('playgroundgame_module_options'), |
||
582 | $sm |
||
583 | ); |
||
584 | |||
585 | return $mapper; |
||
586 | }, |
||
587 | |||
588 | 'playgroundgame_prizecategory_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
589 | $mapper = new \PlaygroundGame\Mapper\PrizeCategory( |
||
590 | $sm->get('doctrine.entitymanager.orm_default'), |
||
591 | $sm->get('playgroundgame_module_options'), |
||
592 | $sm |
||
593 | ); |
||
594 | |||
595 | return $mapper; |
||
596 | }, |
||
597 | |||
598 | 'playgroundgame_prizecategoryuser_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
599 | $mapper = new \PlaygroundGame\Mapper\PrizeCategoryUser( |
||
600 | $sm->get('doctrine.entitymanager.orm_default'), |
||
601 | $sm->get('playgroundgame_module_options'), |
||
602 | $sm |
||
603 | ); |
||
604 | |||
605 | return $mapper; |
||
606 | }, |
||
607 | |||
608 | 'playgroundgame_invitation_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
609 | $mapper = new \PlaygroundGame\Mapper\Invitation( |
||
610 | $sm->get('doctrine.entitymanager.orm_default'), |
||
611 | $sm->get('playgroundgame_module_options'), |
||
612 | $sm |
||
613 | ); |
||
614 | |||
615 | return $mapper; |
||
616 | }, |
||
617 | |||
618 | 'playgroundgame_mission_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
619 | $mapper = new Mapper\Mission( |
||
620 | $sm->get('doctrine.entitymanager.orm_default'), |
||
621 | $sm->get('playgroundgame_module_options'), |
||
622 | $sm |
||
623 | ); |
||
624 | |||
625 | return $mapper; |
||
626 | }, |
||
627 | |||
628 | 'playgroundgame_mission_game_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
629 | $mapper = new Mapper\MissionGame( |
||
630 | $sm->get('doctrine.entitymanager.orm_default'), |
||
631 | $sm->get('playgroundgame_module_options'), |
||
632 | $sm |
||
633 | ); |
||
634 | |||
635 | return $mapper; |
||
636 | }, |
||
637 | |||
638 | 'playgroundgame_mission_game_condition_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
639 | $mapper = new Mapper\MissionGameCondition( |
||
640 | $sm->get('doctrine.entitymanager.orm_default'), |
||
641 | $sm->get('playgroundgame_module_options'), |
||
642 | $sm |
||
643 | ); |
||
644 | |||
645 | return $mapper; |
||
646 | }, |
||
647 | |||
648 | 'playgroundgame_tradingcard_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
649 | $mapper = new Mapper\TradingCard( |
||
650 | $sm->get('doctrine.entitymanager.orm_default'), |
||
651 | $sm->get('playgroundgame_module_options'), |
||
652 | $sm |
||
653 | ); |
||
654 | |||
655 | return $mapper; |
||
656 | }, |
||
657 | |||
658 | 'playgroundgame_tradingcard_model_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
659 | $mapper = new Mapper\TradingCardModel( |
||
660 | $sm->get('doctrine.entitymanager.orm_default'), |
||
661 | $sm->get('playgroundgame_module_options'), |
||
662 | $sm |
||
663 | ); |
||
664 | |||
665 | return $mapper; |
||
666 | }, |
||
667 | |||
668 | 'playgroundgame_tradingcard_card_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
669 | $mapper = new Mapper\TradingCardCard( |
||
670 | $sm->get('doctrine.entitymanager.orm_default'), |
||
671 | $sm->get('playgroundgame_module_options'), |
||
672 | $sm |
||
673 | ); |
||
674 | |||
675 | return $mapper; |
||
676 | }, |
||
677 | |||
678 | 'playgroundgame_memory_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
679 | $mapper = new Mapper\Memory( |
||
680 | $sm->get('doctrine.entitymanager.orm_default'), |
||
681 | $sm->get('playgroundgame_module_options'), |
||
682 | $sm |
||
683 | ); |
||
684 | |||
685 | return $mapper; |
||
686 | }, |
||
687 | |||
688 | 'playgroundgame_memory_card_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
689 | $mapper = new Mapper\MemoryCard( |
||
690 | $sm->get('doctrine.entitymanager.orm_default'), |
||
691 | $sm->get('playgroundgame_module_options'), |
||
692 | $sm |
||
693 | ); |
||
694 | |||
695 | return $mapper; |
||
696 | }, |
||
697 | |||
698 | 'playgroundgame_memory_score_mapper' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
699 | $mapper = new Mapper\MemoryScore( |
||
700 | $sm->get('doctrine.entitymanager.orm_default'), |
||
701 | $sm->get('playgroundgame_module_options'), |
||
702 | $sm |
||
703 | ); |
||
704 | |||
705 | return $mapper; |
||
706 | }, |
||
707 | |||
708 | View Code Duplication | 'playgroundgame_tradingcardmodel_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
709 | $translator = $sm->get('MvcTranslator'); |
||
710 | $form = new Form\Admin\TradingCardModel(null, $sm, $translator); |
||
711 | $tradingcardmodel = new Entity\TradingCardModel(); |
||
712 | $form->setInputFilter($tradingcardmodel->getInputFilter()); |
||
713 | |||
714 | return $form; |
||
715 | }, |
||
716 | |||
717 | View Code Duplication | 'playgroundgame_tradingcard_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
718 | $translator = $sm->get('MvcTranslator'); |
||
719 | $form = new Form\Admin\TradingCard(null, $sm, $translator); |
||
720 | $tradingcard = new Entity\TradingCard(); |
||
721 | $form->setInputFilter($tradingcard->getInputFilter()); |
||
722 | |||
723 | return $form; |
||
724 | }, |
||
725 | |||
726 | View Code Duplication | 'playgroundgame_memory_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
727 | $translator = $sm->get('MvcTranslator'); |
||
728 | $form = new Form\Admin\Memory(null, $sm, $translator); |
||
729 | $memory = new Entity\Memory(); |
||
730 | $form->setInputFilter($memory->getInputFilter()); |
||
731 | |||
732 | return $form; |
||
733 | }, |
||
734 | |||
735 | View Code Duplication | 'playgroundgame_memorycard_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
736 | $translator = $sm->get('MvcTranslator'); |
||
737 | $form = new Form\Admin\MemoryCard(null, $sm, $translator); |
||
738 | $memoryCard = new Entity\MemoryCard(); |
||
739 | $form->setInputFilter($memoryCard->getInputFilter()); |
||
740 | |||
741 | return $form; |
||
742 | }, |
||
743 | |||
744 | View Code Duplication | 'playgroundgame_mission_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
745 | $translator = $sm->get('MvcTranslator'); |
||
746 | $form = new Form\Admin\Mission(null, $sm, $translator); |
||
747 | $mission = new Entity\Mission(); |
||
748 | $form->setInputFilter($mission->getInputFilter()); |
||
749 | |||
750 | return $form; |
||
751 | }, |
||
752 | |||
753 | View Code Duplication | 'playgroundgame_mission_game_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
754 | $translator = $sm->get('MvcTranslator'); |
||
755 | $form = new Form\Admin\MissionGameFieldset(null, $sm, $translator); |
||
756 | $missionGame = new Entity\MissionGame(); |
||
757 | $form->setInputFilter($missionGame->getInputFilter()); |
||
0 ignored issues
–
show
The method
setInputFilter() does not seem to exist on object<PlaygroundGame\Fo...in\MissionGameFieldset> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
758 | return $form; |
||
759 | }, |
||
760 | |||
761 | View Code Duplication | 'playgroundgame_game_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
762 | $translator = $sm->get('MvcTranslator'); |
||
763 | $form = new Form\Admin\Game(null, $sm, $translator); |
||
764 | $game = new Entity\Game(); |
||
765 | $form->setInputFilter($game->getInputFilter()); |
||
766 | |||
767 | return $form; |
||
768 | }, |
||
769 | |||
770 | 'playgroundgame_register_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
771 | $translator = $sm->get('MvcTranslator'); |
||
772 | $zfcUserOptions = $sm->get('zfcuser_module_options'); |
||
773 | $form = new Form\Frontend\Register(null, $zfcUserOptions, $translator, $sm); |
||
774 | $form->setInputFilter(new \ZfcUser\Form\RegisterFilter( |
||
775 | new \ZfcUser\Validator\NoRecordExists(array( |
||
776 | 'mapper' => $sm->get('zfcuser_user_mapper'), |
||
777 | 'key' => 'email', |
||
778 | )), |
||
779 | new \ZfcUser\Validator\NoRecordExists(array( |
||
780 | 'mapper' => $sm->get('zfcuser_user_mapper'), |
||
781 | 'key' => 'username', |
||
782 | )), |
||
783 | $zfcUserOptions |
||
784 | )); |
||
785 | |||
786 | return $form; |
||
787 | }, |
||
788 | |||
789 | 'playgroundgame_import_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
790 | $translator = $sm->get('MvcTranslator'); |
||
791 | $form = new Form\Admin\Import(null, $sm, $translator); |
||
792 | |||
793 | return $form; |
||
794 | }, |
||
795 | |||
796 | View Code Duplication | 'playgroundgame_lottery_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
797 | $translator = $sm->get('MvcTranslator'); |
||
798 | $form = new Form\Admin\Lottery(null, $sm, $translator); |
||
799 | $lottery = new Entity\Lottery(); |
||
800 | $form->setInputFilter($lottery->getInputFilter()); |
||
801 | |||
802 | return $form; |
||
803 | }, |
||
804 | |||
805 | View Code Duplication | 'playgroundgame_quiz_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
806 | $translator = $sm->get('MvcTranslator'); |
||
807 | $form = new Form\Admin\Quiz(null, $sm, $translator); |
||
808 | $quiz = new Entity\Quiz(); |
||
809 | $form->setInputFilter($quiz->getInputFilter()); |
||
810 | |||
811 | return $form; |
||
812 | }, |
||
813 | |||
814 | View Code Duplication | 'playgroundgame_instantwin_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
815 | $translator = $sm->get('MvcTranslator'); |
||
816 | $form = new Form\Admin\InstantWin(null, $sm, $translator); |
||
817 | $instantwin = new Entity\InstantWin(); |
||
818 | $form->setInputFilter($instantwin->getInputFilter()); |
||
819 | |||
820 | return $form; |
||
821 | }, |
||
822 | |||
823 | View Code Duplication | 'playgroundgame_quizquestion_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
824 | $translator = $sm->get('MvcTranslator'); |
||
825 | $form = new Form\Admin\QuizQuestion(null, $sm, $translator); |
||
826 | $quizQuestion = new Entity\QuizQuestion(); |
||
827 | $form->setInputFilter($quizQuestion->getInputFilter()); |
||
828 | |||
829 | return $form; |
||
830 | }, |
||
831 | |||
832 | View Code Duplication | 'playgroundgame_instantwinoccurrence_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
833 | $translator = $sm->get('MvcTranslator'); |
||
834 | $form = new Form\Admin\InstantWinOccurrence(null, $sm, $translator); |
||
835 | $instantwinOccurrence = new Entity\InstantWinOccurrence(); |
||
836 | $form->setInputFilter($instantwinOccurrence->getInputFilter()); |
||
837 | |||
838 | return $form; |
||
839 | }, |
||
840 | |||
841 | 'playgroundgame_instantwinoccurrenceimport_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
842 | $translator = $sm->get('MvcTranslator'); |
||
843 | $form = new Form\Admin\InstantWinOccurrenceImport(null, $sm, $translator); |
||
844 | return $form; |
||
845 | }, |
||
846 | |||
847 | View Code Duplication | 'playgroundgame_instantwinoccurrencecode_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
848 | $translator = $sm->get('MvcTranslator'); |
||
849 | $form = new Form\Frontend\InstantWinOccurrenceCode(null, $sm, $translator); |
||
850 | $filter = new Form\Frontend\InstantWinOccurrenceCodeFilter(); |
||
851 | $form->setInputFilter($filter); |
||
852 | return $form; |
||
853 | }, |
||
854 | |||
855 | View Code Duplication | 'playgroundgame_postvote_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
856 | $translator = $sm->get('MvcTranslator'); |
||
857 | $form = new Form\Admin\PostVote(null, $sm, $translator); |
||
858 | $postVote = new Entity\PostVote(); |
||
859 | $form->setInputFilter($postVote->getInputFilter()); |
||
860 | |||
861 | return $form; |
||
862 | }, |
||
863 | |||
864 | View Code Duplication | 'playgroundgame_prizecategory_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
865 | $translator = $sm->get('MvcTranslator'); |
||
866 | $form = new Form\Admin\PrizeCategory(null, $sm, $translator); |
||
867 | $prizeCategory = new Entity\PrizeCategory(); |
||
868 | $form->setInputFilter($prizeCategory->getInputFilter()); |
||
869 | |||
870 | return $form; |
||
871 | }, |
||
872 | |||
873 | 'playgroundgame_prizecategoryuser_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
874 | $translator = $sm->get('MvcTranslator'); |
||
875 | $form = new Form\Frontend\PrizeCategoryUser(null, $sm, $translator); |
||
876 | |||
877 | return $form; |
||
878 | }, |
||
879 | |||
880 | View Code Duplication | 'playgroundgame_sharemail_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
881 | $translator = $sm->get('MvcTranslator'); |
||
882 | $form = new Form\Frontend\ShareMail(null, $sm, $translator); |
||
883 | $form->setInputFilter(new Form\Frontend\ShareMailFilter()); |
||
884 | |||
885 | return $form; |
||
886 | }, |
||
887 | |||
888 | 'playgroundgame_createteam_form' => function (\Zend\ServiceManager\ServiceManager $sm) { |
||
889 | $translator = $sm->get('MvcTranslator'); |
||
890 | $form = new Form\Frontend\CreateTeam(null, $sm, $translator); |
||
891 | |||
892 | return $form; |
||
893 | }, |
||
894 | ), |
||
895 | ); |
||
896 | } |
||
897 | } |
||
898 |
Let’s take a look at an example:
In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different implementation of User which does not have a getDisplayName() method, the code will break.
Available Fixes
Change the type-hint for the parameter:
Add an additional type-check:
Add the method to the interface: