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

User   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 11 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Clayton Daley
5
 * Date: 5/6/2015
6
 * Time: 6:43 PM
7
 */
8
9
namespace ZfcUser\Factory\Mapper;
10
11
use Zend\ServiceManager\FactoryInterface;
12
use Zend\ServiceManager\ServiceLocatorInterface;
13
use ZfcUser\Mapper;
14
15
class User implements FactoryInterface
16
{
17
18
    /**
19
     * Create service
20
     *
21
     * @param ServiceLocatorInterface $serviceLocator
22
     * @return mixed
23
     */
24
    public function createService(ServiceLocatorInterface $serviceLocator)
25
    {
26
        $options = $serviceLocator->get('zfcuser_module_options');
27
        $mapper = new Mapper\User();
28
        $mapper->setDbAdapter($serviceLocator->get('zfcuser_zend_db_adapter'));
0 ignored issues
show
Documentation introduced by
$serviceLocator->get('zfcuser_zend_db_adapter') is of type object|array, but the function expects a object<Zend\Db\Adapter\Adapter>.

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...
29
        $entityClass = $options->getUserEntityClass();
30
        $mapper->setEntityPrototype(new $entityClass);
31
        $mapper->setHydrator(new Mapper\UserHydrator());
32
        $mapper->setTableName($options->getTableName());
33
        return $mapper;
34
    }
35
}
36