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

JobboardSearchFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 14 1
A createFormInstance() 0 4 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2016 Cross Solution <http://cross-solution.de>
8
 */
9
  
10
/** */
11
namespace Jobs\Factory\Form;
12
13
use Core\Factory\Form\AbstractCustomizableFieldsetFactory;
14
use Interop\Container\ContainerInterface;
15
use Jobs\Form\JobboardSearch;
16
use Zend\ServiceManager\FactoryInterface;
17
use Zend\ServiceManager\ServiceLocatorInterface;
18
19
/**
20
 * Factory for the ListFilterLocation (Job Title and Location)
21
 *
22
 * @author Carsten Bleek <[email protected]>
23
 */
24
class JobboardSearchFactory extends AbstractCustomizableFieldsetFactory
25
{
26
27
    const OPTIONS_NAME = 'Jobs/JobboardSearchOptions';
28
29
    /**
30
     * Create an object
31
     *
32
     * @param  ContainerInterface $container
33
     * @param  string             $requestedName
34
     * @param  null|array         $options
35
     *
36
     * @return object
37
     * @throws ServiceNotFoundException if unable to resolve the service.
38
     * @throws ServiceNotCreatedException if an exception is raised when
39
     *     creating a service.
40
     * @throws ContainerException if any other error occurs
41
     */
42
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
43
    {
44
        /* @var \Geo\Options\ModuleOptions $options */
45
        $options = $container->get('Geo/Options');
46
        /* @var \Jobs\Options\JobboardSearchOptions $jobboardSearchOptions */
47
        $fs = new JobboardSearch(
48
            [
49
                'location_engine_type' => $options->getPlugin(),
50
                'button_element' => 'd',
51
            ]
52
        );
53
54
        return $fs;
55
    }
56
57
    protected function createFormInstance(ContainerInterface $container, $name, array $options = null)
58
    {
59
        return $this($container, JobboardSearch::class);
60
    }
61
62
}
63