Passed
Push — master ( ccc392...9ce164 )
by Angel Fernando Quiroz
09:52 queued 39s
created

AdminBlockDisplayedEvent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getItems() 0 3 1
A setItems() 0 7 1
A getBlockNames() 0 3 1
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Event;
8
9
class AdminBlockDisplayedEvent extends AbstractEvent
10
{
11
    /**
12
     * @return array<int, array<string, string>>
13
     */
14
    public function getItems(string $title): array
15
    {
16
        return $this->data[$title]['items'] ?? [];
17
    }
18
19
    public function setItems(string $title, array $items): static
20
    {
21
        $currentItems = $this->data[$title]['items'] ?? [];
22
23
        $this->data[$title]['items'] = [...$currentItems, ...$items];
24
25
        return $this;
26
    }
27
28
    /**
29
     * @return array<int, string>
30
     */
31
    public function getBlockNames(): array
32
    {
33
        return array_keys($this->data);
34
    }
35
}
36