Completed
Push — develop ( b8f7b1...cea6ad )
by
unknown
07:05
created

ApplyUrlFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 13 1
A createService() 0 4 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
7
 * @license   MIT
8
 * @author    [email protected]
9
 */
10
11
namespace Jobs\Factory\View\Helper;
12
13
use Interop\Container\ContainerInterface;
14
use Zend\ServiceManager\FactoryInterface;
15
use Zend\ServiceManager\ServiceLocatorInterface;
16
use Jobs\View\Helper\ApplyUrl;
17
18
/**
19
 * Factory for ApplyUrl view helper
20
 *
21
 * @author Mathias Weitz <[email protected]>
22
 * @author Mathias Gelhausen <[email protected]>
23
 */
24
class ApplyUrlFactory implements FactoryInterface
25
{
26
27
    /**
28
     * Create an object
29
     *
30
     * @param  ContainerInterface $container
31
     * @param  string             $requestedName
32
     * @param  null|array         $options
33
     *
34
     * @return object
35
     * @throws ServiceNotFoundException if unable to resolve the service.
36
     * @throws ServiceNotCreatedException if an exception is raised when
37
     *     creating a service.
38
     * @throws ContainerException if any other error occurs
39
     */
40
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
41
    {
42
        $helper    = new ApplyUrl();
43
        $url       = $container->get('url');
44
        $translate = $container->get('translate');
45
        $params    = $container->get('params');
46
        $serverUrl = $container->get('serverUrl');
47
        $helper->setUrlHelper($url)
48
               ->setTranslateHelper($translate)
49
               ->setParamsHelper($params)
50
               ->setServerUrlHelper($serverUrl);
51
        return $helper;
52
    }
53
54
55
    public function createService(ServiceLocatorInterface $services)
56
    {
57
        return $this($services, ApplyUrl::class);
58
    }
59
}
60