ExamDateGroup::getItems()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace App\Grouping;
4
5
use DateTime;
6
use App\Entity\Exam;
7
8
class ExamDateGroup implements GroupInterface, SortableGroupInterface {
9
    /**
10
     * @var Exam[]
11
     */
12
    private ?array $exams = null;
13
14
    public function __construct(private DateTime $date)
15
    {
16
    }
17
18
    public function getDate(): DateTime {
19
        return $this->date;
20
    }
21
22
    /**
23
     * @return Exam[]
24
     */
25
    public function getExams() {
26
        return $this->exams;
27
    }
28
29
    /**
30
     * @return DateTime
31
     */
32
    public function getKey() {
33
        return $this->date;
34
    }
35
36
    /**
37
     * @param Exam $item
38
     */
39
    public function addItem($item) {
40
        $this->exams[] = $item;
41
    }
42
43
    /**
44
     * @return Exam[]
45
     */
46
    public function &getItems(): array {
47
        return $this->exams;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->exams could return the type null which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
48
    }
49
}