Passed
Push — master ( 6506fa...b67d4f )
by Angel Fernando Quiroz
07:50
created

DocumentItemViewEvent::addLink()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
declare(strict_types=1);
6
7
namespace Chamilo\CoreBundle\Event;
8
9
use Chamilo\CourseBundle\Entity\CDocument;
10
11
class DocumentItemViewEvent extends AbstractEvent
12
{
13
    public function getDocument(): ?CDocument
14
    {
15
        return $this->data['document'] ?? null;
16
    }
17
18
    public function addLink(string $link): static
19
    {
20
        $this->data['links'][] = $link;
21
22
        return $this;
23
    }
24
25
    public function getLinks(): array
26
    {
27
        return $this->data['links'] ?? [];
28
    }
29
}
30