Passed
Pull Request — master (#6127)
by Angel Fernando Quiroz
07:51
created

AdminBlockHookEvent::getBlockNames()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\HookEvent;
8
9
class AdminBlockHookEvent extends HookEvent
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