Passed
Push — master ( c541cb...64a56e )
by Chris
33s
created

TicketAvailability   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 7 1
1
<?php
2
3
4
namespace ConferenceTools\Tickets\Service\Factory\Service;
5
6
7
use Doctrine\ORM\EntityManager;
8
use ConferenceTools\Tickets\Domain\Service\Configuration;
9
use ConferenceTools\Tickets\Domain\Service\TicketAvailability\TicketAvailability as TicketAvailabilityService;
10
use ConferenceTools\Tickets\Domain\Service\TicketAvailability\TicketTypeFilter;
11
use ConferenceTools\Tickets\Finder\TicketCounter;
12
use Zend\ServiceManager\FactoryInterface;
13
use Zend\ServiceManager\ServiceLocatorInterface;
14
15
class TicketAvailability implements FactoryInterface
16
{
17
    public function createService(ServiceLocatorInterface $serviceLocator)
18
    {
19
        return new TicketAvailabilityService(
20
            new TicketTypeFilter($serviceLocator->get(Configuration::class)),
0 ignored issues
show
Documentation introduced by
$serviceLocator->get(\Co...e\Configuration::class) is of type object|array, but the function expects a object<ConferenceTools\T...\Service\Configuration>.

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...
21
            new TicketCounter($serviceLocator->get(EntityManager::class))
0 ignored issues
show
Documentation introduced by
$serviceLocator->get(\Do...M\EntityManager::class) is of type object|array, but the function expects a object<Doctrine\ORM\EntityManager>.

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...
22
        );
23
    }
24
}