Page   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 81
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A __toString() 0 8 1
A getIterator() 0 4 1
1
<?php
2
/**
3
 * This file is part of the Ray.AuraSqlModule package.
4
 *
5
 * @license http://opensource.org/licenses/MIT MIT
6
 */
7
namespace Ray\AuraSqlModule\Pagerfanta;
8
9
use Pagerfanta\Pagerfanta;
10
use Pagerfanta\View\ViewInterface;
11
12
final class Page implements \IteratorAggregate
13
{
14
    /**
15
     * @var int
16
     */
17
    public $maxPerPage;
18
19
    /**
20
     * @var int
21
     */
22
    public $current;
23
24
    /**
25
     * @var int
26
     */
27
    public $total;
28
29
    /**
30
     * @var bool
31
     */
32
    public $hasNext;
33
34
    /**
35
     * @var bool
36
     */
37
    public $hasPrevious;
38
39
    /**
40
     * @var mixed
41
     */
42
    public $data;
43
44
    /**
45
     * @var Pagerfanta
46
     */
47
    private $pagerfanta;
48
49
    /**
50
     * @var callable
51
     */
52
    private $routeGenerator;
53
54
    /**
55
     * @var ViewInterface
56
     */
57
    private $view;
58
59
    /**
60
     * @var array
61
     */
62
    private $viewOption;
63
64 9
    public function __construct(
65
        Pagerfanta $pagerfanta,
66
        RouteGeneratorInterface $routeGenerator,
67
        ViewInterface $view,
68
        array $viewOption
69
    ) {
70 9
        $this->pagerfanta = $pagerfanta;
71 9
        $this->routeGenerator = $routeGenerator;
72 9
        $this->view = $view;
73 9
        $this->viewOption = $viewOption;
74 9
    }
75
76 6
    public function __toString()
77
    {
78 6
        return (string) $this->view->render(
79 6
            $this->pagerfanta,
80 6
            $this->routeGenerator,
81 6
            $this->viewOption
82
        );
83
    }
84
85
    /**
86
     * {@inheritdoc}
87
     */
88 1
    public function getIterator()
89
    {
90 1
        return $this->pagerfanta->getIterator();
91
    }
92
}
93