Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
66.67% |
4 / 6 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
VectorComponentPinnableContainer | |
66.67% |
4 / 6 |
|
50.00% |
1 / 2 |
2.15 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getTemplateData | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace MediaWiki\Skins\Vector\Components; |
3 | |
4 | /** |
5 | * VectorComponentPinnableContainer component |
6 | * To be used with PinnableContainer/Pinned or PinnableContainer/Unpinned templates. |
7 | */ |
8 | class VectorComponentPinnableContainer implements VectorComponent { |
9 | /** @var string */ |
10 | private $id; |
11 | /** @var bool */ |
12 | private $isPinned; |
13 | |
14 | /** |
15 | * @param string $id |
16 | * @param bool $isPinned |
17 | */ |
18 | public function __construct( string $id, bool $isPinned = true ) { |
19 | $this->id = $id; |
20 | $this->isPinned = $isPinned; |
21 | } |
22 | |
23 | /** |
24 | * @inheritDoc |
25 | */ |
26 | public function getTemplateData(): array { |
27 | return [ |
28 | 'id' => $this->id, |
29 | 'is-pinned' => $this->isPinned, |
30 | ]; |
31 | } |
32 | } |