AuraSqlQueryPagerFactory::newInstance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 4
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\AuraSqlModule\Pagerfanta;
6
7
use Aura\Sql\ExtendedPdoInterface;
8
use Aura\SqlQuery\Common\SelectInterface;
9
10
class AuraSqlQueryPagerFactory implements AuraSqlQueryPagerFactoryInterface
11
{
12
    private AuraSqlQueryPagerInterface $auraSqlQueryPager;
13
14
    public function __construct(AuraSqlQueryPagerInterface $auraSqlQueryPager)
15
    {
16
        $this->auraSqlQueryPager = $auraSqlQueryPager;
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function newInstance(ExtendedPdoInterface $pdo, SelectInterface $select, $paging, $uriTemplate)
23
    {
24
        $this->auraSqlQueryPager->init($pdo, $select, $paging, new DefaultRouteGenerator($uriTemplate));
25
26
        return $this->auraSqlQueryPager;
27
    }
28
}
29