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

Pagination::getMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 4
rs 10
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