Test Setup Failed
Pull Request — master (#1)
by Florian
10:46
created

Doctrine2Paginator   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A paginate() 0 7 1
1
<?php
2
declare(strict_types = 1);
3
/**
4
 * Copyright (c) Phauthentic (https://github.com/Phauthentic)
5
 *
6
 * Licensed under The MIT License
7
 * For full copyright and license information, please see the LICENSE.txt
8
 * Redistributions of files must retain the above copyright notice.
9
 *
10
 * @copyright     Copyright (c) Phauthentic (https://github.com/Phauthentic)
11
 * @link          https://github.com/Phauthentic
12
 * @license       https://opensource.org/licenses/mit-license.php MIT License
13
 */
14
namespace Phauthentic\Pagination\Paginator;
15
16
use Psr\Http\Message\ServerRequestInterface;
17
18
/**
19
 * PaginationToDoctrineRepositoryMapper
20
 *
21
 * @link https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/tutorials/pagination.html
22
 */
23
class Doctrine2Paginator implements PaginatorInterface
24
{
25
    /**
26
     * Maps the params to the repository
27
     *
28
     * @param \Phauthentic\Pagination\PaginationParamsInterface $paginationParams Pagination params
29
     * @param mixed $repository
30
     */
31
    public function paginate(PaginationParamsInterface $paginationParams, $repository)
0 ignored issues
show
Bug introduced by
The type Phauthentic\Pagination\P...ginationParamsInterface 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...
32
    {
33
        $query = $repository
34
           ->setFirstResult($paginationParams->getCurrentPage())
35
           ->setMaxResults($paginationParams->getLimit());
36
37
        return new Paginator($query, $fetchJoinCollection = true);
38
    }
39
}
40