GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ListEmployeeQuery   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A findAll() 0 18 1
1
<?php
2
declare(strict_types=1);
3
4
/*
5
 * This file is part of the AL labs package
6
 *
7
 * (c) Arnaud Langlade
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace Al\ResourceManagement\Infrastructure\Persistence\Doctrine;
14
15
use Al\ResourceManagement\Domain\Employee;
16
use Al\ResourceManagement\Domain\ReadModel\EmployeeList;
17
use Doctrine\ORM\EntityManagerInterface;
18
use Pagerfanta\Adapter\DoctrineORMAdapter;
19
use Pagerfanta\Pagerfanta;
20
21
final class ListEmployeeQuery
22
{
23
    /** @var EntityManagerInterface */
24
    private $entityManager;
25
26
    /**
27
     * @param EntityManagerInterface $entityManager
28
     */
29
    public function __construct(EntityManagerInterface $entityManager)
30
    {
31
        $this->entityManager = $entityManager;
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function findAll(int $page = 1, int $limit = 10): Pagerfanta
38
    {
39
        $queryBuilder = $this->entityManager->createQueryBuilder()
40
            ->select(
41
                sprintf(
42
                    'NEW %s(employee.id, employee.name, employee.position, employee.salaryScale, employee.firedAt)',
43
                    EmployeeList::class
44
                )
45
            )
46
            ->from(Employee::class, 'employee')
47
            ->getQuery();
48
49
        $employees = new Pagerfanta(new DoctrineORMAdapter($queryBuilder, false, false));
50
        $employees->setCurrentPage($page);
51
        $employees->setMaxPerPage($limit);
52
53
        return $employees;
54
    }
55
}
56