Completed
Push — master ( 2d3077...b72a1b )
by Peter
02:16
created

Builder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A paginate() 0 4 1
1
<?php
2
/**
3
 * AnimeDb package
4
 *
5
 * @package   AnimeDb
6
 * @author    Peter Gribanov <[email protected]>
7
 * @copyright Copyright (c) 2011, Peter Gribanov
8
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
9
 */
10
11
namespace AnimeDb\Bundle\PaginationBundle\Service;
12
13
/**
14
 * @package AnimeDb\Bundle\PaginationBundle\Service
15
 * @author  Peter Gribanov <[email protected]>
16
 */
17
class Builder
18
{
19
    /**
20
     * The number of pages displayed in the navigation
21
     *
22
     * @var int
23
     */
24
    protected $max_navigate = Configuration::DEFAULT_LIST_LENGTH;
25
26
    /**
27
     * @param int $max_navigate
28
     */
29 2
    public function __construct($max_navigate)
30
    {
31 2
        $this->max_navigate = $max_navigate;
32 2
    }
33
34
    /**
35
     * @param int $total_pages
36
     * @param int $current_page
37
     *
38
     * @return Configuration
39
     */
40 2
    public function paginate($total_pages = 0, $current_page = 1) {
41 2
        return (new Configuration($total_pages, $current_page))
42 2
            ->setMaxNavigate($this->max_navigate);
43
    }
44
}
45