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.

Code Duplication    Length = 78-78 lines in 2 locations

src/ToHtml/ToBootstrap3.php 1 location

@@ 8-85 (lines=78) @@
5
use Tuum\Pagination\Paginate\Paginate;
6
use Tuum\Pagination\Paginate\PaginateInterface;
7
8
class ToBootstrap3 implements ToHtmlInterface
9
{
10
    /**
11
     * @var Paginate
12
     */
13
    private $paginate;
14
15
    /**
16
     * ToBootstrap3 constructor.
17
     *
18
     * @param Paginate $paginate
19
     */
20
    public function __construct($paginate = null)
21
    {
22
        $this->paginate = $paginate;
23
    }
24
25
    /**
26
     * @param PaginateInterface $paginate
27
     * @return ToHtmlInterface
28
     */
29
    public function setPaginate(PaginateInterface $paginate)
30
    {
31
        $this->paginate = $paginate;
32
        return $this;
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function __toString()
39
    {
40
        return $this->toString();
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function toString()
47
    {
48
        $paginate = $this->paginate;
49
        $html     = '<ul class="pagination">';
50
        $html     .= $this->liLabel($paginate->getPrevPage(), '&lt;');
51
        $html     .= $this->li($paginate->getFirstPage());
52
        foreach ($paginate as $page) {
53
            $html .= $this->li($page);
54
        }
55
        $html .= $this->li($paginate->getLastPage());
56
        $html     .= $this->liLabel($paginate->getNextPage(), '&gt;');
57
        $html .= '</ul>';
58
59
        return $html;
60
    }
61
62
    /**
63
     * @param Page $p
64
     * @return string
65
     */
66
    private function li(Page $p)
67
    {
68
        $label = $p->isDisabled('...', $p->getPage());
69
        $href  = $p->isCurrent('#', $p->getUrl());
70
        $only  = $p->isCurrent('<span class=\'sr-only\'>current</span>', '');
71
        if ($p->isDisabled()) {
72
            return "<li class=\"disabled\"><a href=\"{$href}\" >{$label}</a></li>";
73
        }
74
        if ($p->isCurrent()) {
75
            return "<li class=\"active\"><a href=\"{$href}\" >{$label}{$only}</a></li>\n";
76
        }
77
78
        return "<li><a href=\"{$href}\" >{$label}{$only}</a></li>\n";
79
    }
80
    
81
    private function liLabel(Page $p, $label)
82
    {
83
        return "<li class=\"{$p->isCurrent('disabled')}\"><a href=\"{$p->isCurrent('#', $p->getUrl())}\" >{$label}</a></li>\n";
84
    }
85
}

src/ToHtml/ToBootstrap4.php 1 location

@@ 8-85 (lines=78) @@
5
use Tuum\Pagination\Paginate\Paginate;
6
use Tuum\Pagination\Paginate\PaginateInterface;
7
8
class ToBootstrap4 implements ToHtmlInterface
9
{
10
    /**
11
     * @var Paginate
12
     */
13
    private $paginate;
14
15
    /**
16
     * ToBootstrap3 constructor.
17
     *
18
     * @param Paginate $paginate
19
     */
20
    public function __construct($paginate = null)
21
    {
22
        $this->paginate = $paginate;
23
    }
24
25
    /**
26
     * @param PaginateInterface $paginate
27
     * @return ToHtmlInterface
28
     */
29
    public function setPaginate(PaginateInterface $paginate)
30
    {
31
        $this->paginate = $paginate;
32
        return $this;
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function __toString()
39
    {
40
        return $this->toString();
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function toString()
47
    {
48
        $paginate = $this->paginate;
49
        $html     = '<nav aria-label="CPD point list"><ul class="pagination">';
50
        $html     .= $this->liLabel($paginate->getPrevPage(), '&lt;');
51
        $html     .= $this->li($paginate->getFirstPage());
52
        foreach ($paginate as $page) {
53
            $html .= $this->li($page);
54
        }
55
        $html .= $this->li($paginate->getLastPage());
56
        $html     .= $this->liLabel($paginate->getNextPage(), '&gt;');
57
        $html .= '</ul></nav>';
58
59
        return $html;
60
    }
61
62
    /**
63
     * @param Page $p
64
     * @return string
65
     */
66
    private function li(Page $p)
67
    {
68
        $label = $p->isDisabled('...', $p->getPage());
69
        $href  = $p->isCurrent('#', $p->getUrl());
70
        $only  = $p->isCurrent('<span class=\'page-link sr-only\'>current</span>', '');
71
        if ($p->isDisabled()) {
72
            return "<li class=\"page-item disabled\"><a class='page-link' href=\"{$href}\" >{$label}</a></li>";
73
        }
74
        if ($p->isCurrent()) {
75
            return "<li class=\"page-item active\"><a class='page-link' href=\"{$href}\" >{$label}{$only}</a></li>\n";
76
        }
77
78
        return "<li class='page-item'><a class='page-link' href=\"{$href}\" >{$label}{$only}</a></li>\n";
79
    }
80
    
81
    private function liLabel(Page $p, $label)
82
    {
83
        return "<li class=\"{$p->isCurrent('disabled')}\"><a class='page-link' href=\"{$p->isCurrent('#', $p->getUrl())}\" >{$label}</a></li>\n";
84
    }
85
}