AuraSqlPagerFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 17
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A newInstance() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\AuraSqlModule\Pagerfanta;
6
7
use Aura\Sql\ExtendedPdoInterface;
8
9
class AuraSqlPagerFactory implements AuraSqlPagerFactoryInterface
10
{
11
    private AuraSqlPagerInterface $auraSqlPager;
12
13
    public function __construct(AuraSqlPagerInterface $auraSqlPager)
14
    {
15
        $this->auraSqlPager = $auraSqlPager;
16
    }
17
18
    /**
19
     * {@inheritDoc}
20
     */
21
    public function newInstance(ExtendedPdoInterface $pdo, string $sql, array $params, int $paging, string $uriTemplate, ?string $entity = null): AuraSqlPagerInterface
22
    {
23
        $this->auraSqlPager->init($pdo, $sql, $params, $paging, new DefaultRouteGenerator($uriTemplate), $entity);
24
25
        return $this->auraSqlPager;
26
    }
27
}
28