Completed
Push — master ( 898500...e76c1b )
by Nikolas
03:28
created

ActionMenuItem::getCaption()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php namespace rtens\domin\delivery\web\menu;
2
3
use rtens\domin\delivery\web\Element;
4
use rtens\domin\delivery\web\Url;
5
6
class ActionMenuItem implements MenuItem {
7
8
    /** @var string */
9
    private $actionId;
10
11
    /** @var array */
12
    private $parameters;
13
14
    /** @var string */
15
    private $caption;
16
17
    public function __construct($caption, $actionId, $parameters = []) {
18
        $this->actionId = $actionId;
19
        $this->parameters = $parameters;
20
        $this->caption = $caption;
21
    }
22
23
    public function render() {
24
        return new Element('li', [], [
25
            new Element('a', ['href' => (string)Url::relative($this->actionId, $this->parameters)], [$this->getCaption()])
26
        ]);
27
    }
28
29
    private function getCaption() {
30
        return $this->caption;
31
    }
32
}