Completed
Push — master ( 392874...829d42 )
by Albert
05:23
created

Paginator   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

4 Methods

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