Passed
Push — master ( 648548...5e4c5e )
by Bruno
08:25
created

Pagination   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
c 1
b 0
f 1
dl 0
loc 22
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMetadata() 0 4 1
A render() 0 14 1
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\Bootstrapvue\Element;
4
5
use Formularium\Element;
6
use Formularium\Frontend\HTML\Element\Pagination as HTMLPagination;
7
use Formularium\HTMLNode;
8
use Formularium\Metadata;
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
                'v-model' => $name . "." . HTMLPagination::CURRENT_PAGE,
19
                ':total-rows' => $name . "." . HTMLPagination::TOTAL_ITEMS,
20
                ':per-page' => $name . "." . HTMLPagination::PER_PAGE,
21
                // TODO 'aria-controls' =>
22
            ]
23
        );
24
25
        return $p;
26
    }
27
28
    public static function getMetadata(): Metadata
29
    {
30
        $metadata = HTMLPagination::getMetadata();
31
        return $metadata;
32
    }
33
}
34