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

ActionMenuItem::getTarget()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 11
Ratio 100 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 11
loc 11
rs 9.4285
cc 3
eloc 8
nc 2
nop 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A ActionMenuItem::getCaption() 0 3 1
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
}