GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PaginationControl   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 12
c 2
b 0
f 2
lcom 0
cbo 1
dl 0
loc 39
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C __invoke() 0 32 12
1
<?php
2
3
/**
4
 * Paginator view helper.
5
 *
6
 * Long description for file (if any)...
7
 *
8
 * @author     Leandro Silva <[email protected]>
9
 *
10
 * @category   LosUi
11
 *
12
 * @license    https://github.com/Lansoweb/LosUi/blob/master/LICENSE MIT License
13
 *
14
 * @link       http://github.com/LansoWeb/LosUi
15
 * @link       http://getbootstrap.com/components/#pagination
16
 */
17
namespace LosUi\View\Helper;
18
19
use Zend\View\Helper\PaginationControl as ZfPaginationControl;
20
use Zend\Paginator;
21
22
/**
23
 * Paginator view helper.
24
 *
25
 * Long description for file (if any)...
26
 *
27
 * @author     Leandro Silva <[email protected]>
28
 *
29
 * @category   LosUi
30
 *
31
 * @license    https://github.com/Lansoweb/LosUi/blob/master/LICENSE MIT License
32
 *
33
 * @link       http://github.com/LansoWeb/LosUi
34
 * @link       http://getbootstrap.com/components/#pagination
35
 */
36
class PaginationControl extends ZfPaginationControl
37
{
38
    protected static $defaultViewPartial = 'paginator/control.phtml';
39
    protected static $nextLabel = 'Next &rarr;';
40
    protected static $previousLabel = '&larr; Previous';
41
42
    public function __invoke(
43
        Paginator\Paginator $paginator = null,
44
        $scrollingStyle = null,
45
        $partial = null,
46
        $params = null
47
    ) {
48
        if (is_string($params)) {
49
            $params = (array) $params;
50
        }
51
52
        if (isset($params['size'])) {
53
            if ($params['size'] != 'sm' && $params['size'] != 'lg') {
54
                throw new \RuntimeException('Size parameter must be either "sm" or "lg"');
55
            }
56
        }
57
        if ($partial === null && isset($params['type'])) {
58
            if ($params['type'] == 'pager') {
59
                $partial = 'paginator/pager.phtml';
60
            }
61
        }
62
        if (! isset($params['aligned']) || ! is_bool($params['aligned'])) {
63
            $params['aligned'] = true;
64
        }
65
        if (! isset($params['nextLabel'])) {
66
            $params['nextLabel'] = self::$nextLabel;
67
        }
68
        if (! isset($params['previousLabel'])) {
69
            $params['previousLabel'] = self::$previousLabel;
70
        }
71
72
        return parent::__invoke($paginator, $scrollingStyle, $partial, $params);
73
    }
74
}
75