Completed
Push — master ( eaa10a...12d04d )
by Albert
03:25
created

Paginator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 37
ccs 0
cts 23
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A render() 0 8 1
A getPage() 0 4 1
A getPerPage() 0 4 1
1
<?php
2
3
namespace Albert221\Blog\Pagination;
4
5
class Paginator
6
{
7
    private $page;
8
    
9
    private $perPage;
10
    
11
    private $pages;
12
    
13
    private $twig;
14
    
15
    public function __construct($page, $perPage, $pages, \Twig_Environment $twig)
16
    {
17
        $this->page = $page;
18
        $this->perPage = $perPage;
19
        $this->pages = $pages;
20
        $this->twig = $twig;
21
    }
22
23
    public function render()
24
    {
25
        return $this->twig->render('components/pagination.twig', [
26
            'currentPage' => $this->page,
27
            'perPage' => $this->perPage,
28
            'pages' => $this->pages
29
        ]);
30
    }
31
32
    public function getPage()
33
    {
34
        return $this->page;
35
    }
36
37
    public function getPerPage()
38
    {
39
        return $this->perPage;
40
    }
41
}
42