Passed
Push — master ( 06ae89...bb4653 )
by Bruno
08:26
created

Pagination::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
nc 1
nop 2
dl 0
loc 13
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\Buefy\Element;
4
5
use Formularium\Element;
6
use Formularium\Field;
7
use Formularium\Frontend\HTML\Element\Pagination as HTMLPagination;
8
use Formularium\HTMLNode;
9
10
class Pagination extends Element
11
{
12
    public function render(array $parameters, HTMLNode $previous): HTMLNode
13
    {
14
        $name = $parameters[self::NAME] ?? 'paginator';
15
        $p = HTMLNode::factory(
16
            'b-pagination',
17
            [
18
                ':total' => $name . "." . HTMLPagination::TOTAL_ITEMS,
19
                ':current.sync' => $name . "." . HTMLPagination::CURRENT_PAGE,
20
                ':per-page' => $name . "." . HTMLPagination::PER_PAGE
21
            ]
22
        );
23
24
        return $p;
25
    }
26
}
27