Completed
Push — develop ( 2c7f98...cb8417 )
by Carsten
14s
created

NotificationFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 24
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 13 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 */
9
10
/** NotificationFactory.php */
11
namespace Core\Controller\Plugin\Service;
12
13
use Interop\Container\ContainerInterface;
14
use Zend\ServiceManager\Factory\FactoryInterface;
15
use Core\Controller\Plugin\Notification;
16
17
/**
18
 * Create Notification plugin
19
 *
20
 * @package Core\Controller\Plugin\Service
21
 *
22
 * @author Anthonius Munthi <[email protected]>
23
 */
24
class NotificationFactory implements FactoryInterface
25
{
26
    /**
27
     * Create new Notification object
28
     *
29
     * @param ContainerInterface    $container
30
     * @param string                $requestedName
31
     * @param array|null            $options
32
     * @return Notification
33
     */
34
	public function __invoke( ContainerInterface $container, $requestedName, array $options = null )
35
	{
36
		$pluginManager = $container->get('ControllerPluginManager');
37
		$flashMessenger = $pluginManager->get('FlashMessenger');
38
		$translator = $container->get('translator');
39
		
40
		$notificationListener = $container->get('Core/Listener/Notification');
41
		$notification   = new Notification($flashMessenger);
42
		$notification->setListener($notificationListener);
43
		$notification->setTranslator($translator);
44
		
45
		return $notification;
46
	}
47
}
48