PagedQuery   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 50
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getConfiguredQuery() 0 4 1
A getPager() 0 4 1
A getTotalCountStrategy() 0 4 1
A setTotalCountStrategy() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Paysera\Bundle\ApiBundle\Entity;
6
7
use Paysera\Pagination\Entity\Doctrine\ConfiguredQuery;
8
use Paysera\Pagination\Entity\Pager;
9
10
class PagedQuery
11
{
12
    const TOTAL_COUNT_STRATEGY_DEFAULT = 'default';
13
    const TOTAL_COUNT_STRATEGY_ALWAYS = 'always';
14
    const TOTAL_COUNT_STRATEGY_OPTIONAL = 'optional';
15
    const TOTAL_COUNT_STRATEGY_NEVER = 'never';
16
17
    /**
18
     * @var ConfiguredQuery
19
     */
20
    private $configuredQuery;
21
22
    /**
23
     * @var Pager
24
     */
25
    private $pager;
26
27
    /**
28
     * @var string
29
     */
30
    private $totalCountStrategy;
31
32 27
    public function __construct(ConfiguredQuery $configuredQuery, Pager $pager)
33
    {
34 27
        $this->configuredQuery = $configuredQuery;
35 27
        $this->pager = $pager;
36 27
        $this->totalCountStrategy = self::TOTAL_COUNT_STRATEGY_DEFAULT;
37 27
    }
38
39 27
    public function getConfiguredQuery(): ConfiguredQuery
40
    {
41 27
        return $this->configuredQuery;
42
    }
43
44 26
    public function getPager(): Pager
45
    {
46 26
        return $this->pager;
47
    }
48
49 26
    public function getTotalCountStrategy(): string
50
    {
51 26
        return $this->totalCountStrategy;
52
    }
53
54 12
    public function setTotalCountStrategy(string $totalCountStrategy): self
55
    {
56 12
        $this->totalCountStrategy = $totalCountStrategy;
57 12
        return $this;
58
    }
59
}
60