Completed
Pull Request — master (#5)
by Laurent
02:35 queued 42s
created

MonthBillCollection::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 *
4
 */
5
6
/**
7
 * @author Laurent De Coninck <[email protected]>
8
 */
9
class MonthBillCollection
10
{
11
12
    /**
13
     * @var MonthlyFlightBill[]
14
     */
15
    private $flights;
16
17
    public function __construct()
18
    {
19
        $this->flights = [];
20
    }
21
22
    /**
23
     * @param MoneyReceiver $receiver
24
     * @param Bbcvols       $flight
25
     */
26
    public function addFlight(MoneyReceiver $receiver, Bbcvols $flight)
27
    {
28
        if (!isset($this->flights[$receiver->getId()])) {
29
            $this->flights[$receiver->getId()] = new MonthlyFlightBill($receiver);
30
        }
31
32
        $this->flights[$receiver->getId()]->addFlight($flight);
33
    }
34
35
    /**
36
     * @return array|MonthlyFlightBill[]
37
     */
38
    public function getFlights()
39
    {
40
        return $this->flights;
41
    }
42
43
    /**
44
     * @return boolean
45
     */
46
    public function isEmpty()
47
    {
48
        return empty($this->flights);
49
    }
50
51
52
}