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

MonthBillCollection   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A addFlight() 0 8 2
A getFlights() 0 4 1
A isEmpty() 0 4 1
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
}