TicketAvailability   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 0 13 1
1
<?php
2
3
namespace ConferenceTools\Tickets\Service\Factory\Service;
4
5
use ConferenceTools\Tickets\Domain\ReadModel\TicketCounts\TicketCounter;
6
use Doctrine\ORM\EntityManager;
7
use ConferenceTools\Tickets\Domain\Service\Configuration;
8
use ConferenceTools\Tickets\Domain\Service\Availability\TicketAvailability as TicketAvailabilityService;
9
use ConferenceTools\Tickets\Domain\Service\Availability\Filters;
10
use Zend\ServiceManager\FactoryInterface;
11
use Zend\ServiceManager\ServiceLocatorInterface;
12
use Carnage\Cqorms\Persistence\ReadModel\DoctrineRepository;
0 ignored issues
show
Bug introduced by
The type Carnage\Cqorms\Persisten...odel\DoctrineRepository was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
14
class TicketAvailability implements FactoryInterface
15
{
16
    public function createService(ServiceLocatorInterface $serviceLocator)
17
    {
18
        $configuration = $serviceLocator->get(Configuration::class);
19
        $filters = [
20
            new Filters\IsAvailable(),
21
            new Filters\AfterSoldOut($configuration),
0 ignored issues
show
Bug introduced by
It seems like $configuration can also be of type array; however, parameter $configuration of ConferenceTools\Tickets\...rSoldOut::__construct() does only seem to accept ConferenceTools\Tickets\...n\Service\Configuration, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

21
            new Filters\AfterSoldOut(/** @scrutinizer ignore-type */ $configuration),
Loading history...
22
            new Filters\ByDate($configuration),
0 ignored issues
show
Bug introduced by
It seems like $configuration can also be of type array; however, parameter $configuration of ConferenceTools\Tickets\...s\ByDate::__construct() does only seem to accept ConferenceTools\Tickets\...n\Service\Configuration, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

22
            new Filters\ByDate(/** @scrutinizer ignore-type */ $configuration),
Loading history...
23
            new Filters\IsPrivate($configuration)
0 ignored issues
show
Bug introduced by
It seems like $configuration can also be of type array; however, parameter $configuration of ConferenceTools\Tickets\...sPrivate::__construct() does only seem to accept ConferenceTools\Tickets\...n\Service\Configuration, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

23
            new Filters\IsPrivate(/** @scrutinizer ignore-type */ $configuration)
Loading history...
24
        ];
25
26
        return new TicketAvailabilityService(
27
            new DoctrineRepository(TicketCounter::class, $serviceLocator->get(EntityManager::class)),
28
            ...$filters
29
        );
30
    }
31
}