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

NotificationFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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