Completed
Pull Request — develop (#291)
by
unknown
08:07
created

ConsoleControllerFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 13 1
1
<?php
2
/**
3
 * @filesource
4
 * @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de)
5
 * @license MIT
6
 * @author Miroslav Fedeleš <[email protected]>
7
 * @since 0.27
8
 */
9
namespace Solr\Factory\Controller;
10
11
use Zend\ServiceManager\FactoryInterface;
12
use Zend\ServiceManager\ServiceLocatorInterface;
13
use Core\Console\ProgressBar;
14
15
class ConsoleControllerFactory implements FactoryInterface
16
{
17
18
    /**
19
     * Create service
20
     *
21
     * @param ServiceLocatorInterface $serviceLocator
22
     *
23
     * @return UsersController
0 ignored issues
show
Documentation introduced by
Should the return type not be \Solr\Controller\ConsoleController?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
24
     */
25
    public function createService(ServiceLocatorInterface $serviceLocator)
26
    {
27
        /* @var $serviceLocator ServiceLocatorInterface */
28
        $serviceLocator = $serviceLocator->getServiceLocator();
29
        $manager = $serviceLocator->get('Solr/Manager');
30
        $client = $manager->getClient($manager->getOptions()->getJobsPath());
31
        $jobRepository = $serviceLocator->get('repositories')->get('Jobs/Job');
32
        $progressBarFactory = function ($count, $persistenceNamespace = null) {
33
            return new ProgressBar($count, $persistenceNamespace);
34
        };
35
        
36
        return new \Solr\Controller\ConsoleController($client, $jobRepository, $progressBarFactory);
37
    }
38
}
39