Completed
Push — develop ( f2612d...39673b )
by
unknown
15:00 queued 07:47
created

ManageControllerFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 11
loc 11
rs 9.4285
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013-2015 Cross Solution (http://cross-solution.de)
7
 * @license       MIT
8
 */
9
10
namespace Jobs\Factory\Controller;
11
12
use Jobs\Controller\ManageController;
13
use Core\Repository\RepositoryService;
14
use Zend\Mvc\Controller\ControllerManager;
15
use Zend\ServiceManager\FactoryInterface;
16
use Zend\ServiceManager\ServiceLocatorInterface;
17
18 View Code Duplication
class ManageControllerFactory implements FactoryInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20
    /**
21
     * Injects all needed services into the ManageController
22
     *
23
     * @param ServiceLocatorInterface $serviceLocator
24
     *
25
     * @return ManageController
26
     */
27
    public function createService(ServiceLocatorInterface $serviceLocator)
28
    {
29
        /* @var ControllerManager $serviceLocator */
30
        $serviceLocator = $serviceLocator->getServiceLocator();
31
        $auth = $serviceLocator->get('AuthenticationService');
32
        /* @var RepositoryService     $repositoryService */
33
        $repositoryService =    $serviceLocator->get('repositories');
34
35
        $translator =    $serviceLocator->get('translator');
36
        return new ManageController($auth, $repositoryService, $translator);
0 ignored issues
show
Documentation introduced by
$auth is of type object|array, but the function expects a object<Auth\AuthenticationService>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
Documentation introduced by
$translator is of type object|array, but the function expects a object<Zend\Mvc\I18n\Translator>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
37
    }
38
}