Completed
Push — 1.x ( 6e286e...c7aa89 )
by Daniel
45:22 queued 35:25
created

AuthenticationService::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 0
loc 7
rs 9.4286
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Clayton Daley
5
 * Date: 5/6/2015
6
 * Time: 6:40 PM
7
 */
8
9
namespace ZfcUser\Factory;
10
11
use Zend\ServiceManager\FactoryInterface;
12
use Zend\ServiceManager\ServiceLocatorInterface;
13
14
class AuthenticationService implements FactoryInterface
15
{
16
17
    /**
18
     * Create service
19
     *
20
     * @param ServiceLocatorInterface $serviceLocator
21
     * @return mixed
22
     */
23
    public function createService(ServiceLocatorInterface $serviceLocator)
24
    {
25
        return new \Zend\Authentication\AuthenticationService(
26
            $serviceLocator->get('ZfcUser\Authentication\Storage\Db'),
0 ignored issues
show
Documentation introduced by
$serviceLocator->get('Zf...tication\\Storage\\Db') is of type object|array, but the function expects a null|object<Zend\Authent...orage\StorageInterface>.

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...
27
            $serviceLocator->get('ZfcUser\Authentication\Adapter\AdapterChain')
0 ignored issues
show
Documentation introduced by
$serviceLocator->get('Zf...Adapter\\AdapterChain') is of type object|array, but the function expects a null|object<Zend\Authent...apter\AdapterInterface>.

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...
28
        );
29
    }
30
}
31