Completed
Pull Request — 1.x (#627)
by
unknown
08:55
created

User::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 16
rs 9.4285
cc 1
eloc 12
nc 1
nop 1
1
<?php
2
3
namespace ZfcUser\Factory\Service;
4
5
use Zend\ServiceManager\FactoryInterface;
6
use Zend\ServiceManager\ServiceLocatorInterface;
7
use ZfcUser\Service\User as UserService;
8
9
class User implements FactoryInterface
10
{
11
12
    /**
13
     * Create service
14
     *
15
     * @param ServiceLocatorInterface $serviceLocator
16
     * @return mixed
17
     */
18
    public function createService(ServiceLocatorInterface $serviceLocator)
19
    {
20
        $userMapper = $serviceLocator->get('zfcuser_user_mapper');
21
        $authService = $serviceLocator->get('zfcuser_auth_service');
22
        $registerForm = $serviceLocator->get('zfcuser_register_form');
23
        $options = $serviceLocator->get('zfcuser_module_options');
24
        $formHydrator = $serviceLocator->get('zfcuser_user_hydrator');
25
26
        return new UserService(
27
            $userMapper,
0 ignored issues
show
Documentation introduced by
$userMapper is of type object|array, but the function expects a object<ZfcUser\Mapper\UserInterface>.

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
            $authService,
0 ignored issues
show
Documentation introduced by
$authService is of type object|array, but the function expects a object<Zend\Authentication\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...
29
            $registerForm,
0 ignored issues
show
Documentation introduced by
$registerForm is of type object|array, but the function expects a object<Zend\Form\Form>.

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
            $options,
0 ignored issues
show
Documentation introduced by
$options is of type object|array, but the function expects a object<ZfcUser\Options\U...erviceOptionsInterface>.

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...
31
            $formHydrator
0 ignored issues
show
Documentation introduced by
$formHydrator is of type object|array, but the function expects a object<Zend\Hydrator\HydratorInterface>.

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...
32
        );
33
    }
34
}
35