Completed
Push — develop ( d65f66...535cf4 )
by
unknown
13:48
created

GetOrganizationHandlerFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 14 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @copyright (c) 2013-2016 Cross Solution (http://cross-solution.de)
7
 * @author cbleek
8
 * @license   MIT
9
 */
10
11
namespace Organizations\Factory\Controller\Plugin;
12
13
use Zend\ServiceManager\FactoryInterface;
14
use Core\Repository\RepositoryService;
15
use Organizations\Controller\Plugin\GetOrganizationHandler;
16
17
class GetOrganizationHandlerFactory implements FactoryInterface {
18
    public function createService(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator)
19
    {
20
        /* @var $serviceLocator \Zend\Mvc\Controller\PluginManager */
21
        $services = $serviceLocator->getServiceLocator();
22
        /* @var $repositories RepositoryService */
23
        $repositories = $services->get('repositories');
24
        /* @var \Auth\AuthenticationService */
25
        $auth = $services->get('AuthenticationService');
26
        /* @var \Acl\Controller\Plugin\Acl */
27
        $acl = $serviceLocator->get('acl');
28
29
        $plugin = new GetOrganizationHandler($repositories, $auth, $acl);
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
$acl is of type object|array, but the function expects a object<Acl\Controller\Plugin\Acl>.

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...
30
        return $plugin;
31
    }
32
}
33