Completed
Push — develop ( 3d2ac1...0e6c87 )
by
unknown
13:24
created

SettingsFieldsetFactory::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 3
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2017 Cross Solution <http://cross-solution.de>
8
 */
9
  
10
/** */
11
namespace Settings\Form\Factory;
12
13
use Settings\Form\SettingsFieldset;
14
use Interop\Container\ContainerInterface;
15
use Zend\Form\FormElementManager\FormElementManagerV2Polyfill;
16
use Zend\ServiceManager\FactoryInterface;
17
use Zend\ServiceManager\ServiceLocatorInterface; 
18
19
/**
20
 * Factory for \Settings\Form\SettingsFieldset
21
 * 
22
 * @author Mathias Gelhausen <[email protected]>
23
 * @since 0.30
24
 * @todo write test  
25
 */
26
class SettingsFieldsetFactory implements FactoryInterface
27
{
28
    
29
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
30
    {
31
        if (!$container instanceOf FormElementManagerV2Polyfill) {
32
            $container = $container->get('FormElementManager');
33
        }
34
35
        return new $requestedName($container);
36
    }
37
    
38
    public function createService(ServiceLocatorInterface $serviceLocator, $name=null, $requestedName=SettingsFieldset::class)
39
    {
40
        return $this($serviceLocator, $requestedName);
41
    }
42
}
43