Completed
Push — master ( 5e4ebc...f96e76 )
by Florian
13s queued 11s
created

OrganisationEvaluation::getOrganisation()   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
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the vseth-semesterly-reports project.
5
 *
6
 * (c) Florian Moser <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace App\Model\SemesterEvaluation;
13
14
use App\Entity\Event;
15
use App\Entity\Organisation;
16
use App\Entity\SemesterReport;
17
18
class OrganisationEvaluation
19
{
20
    /**
21
     * @var Organisation
22
     */
23
    private $organisation;
24
25
    /**
26
     * @var SemesterReport
27
     */
28
    private $semesterReport;
29
30
    /**
31
     * @var Event[]
32
     */
33
    private $events;
34
35
    /**
36
     * OrganisationEvaluation constructor.
37
     *
38
     * @param Event[] $events
39
     */
40
    public function __construct(Organisation $organisation, SemesterReport $semesterReport, array $events)
41
    {
42
        $this->organisation = $organisation;
43
        $this->semesterReport = $semesterReport;
44
        $this->events = $events;
45
    }
46
47
    public function getOrganisation(): Organisation
48
    {
49
        return $this->organisation;
50
    }
51
52
    public function getSemesterReport(): SemesterReport
53
    {
54
        return $this->semesterReport;
55
    }
56
57
    public function getRevenueSum(): int
58
    {
59
        $revenueSum = 0;
60
        foreach ($this->events as $futureEvent) {
61
            $revenueSum += $futureEvent->getRevenue();
62
        }
63
64
        return $revenueSum;
65
    }
66
67
    public function getExpenditureSum(): int
68
    {
69
        $expenditureSum = 0;
70
        foreach ($this->events as $futureEvent) {
71
            $expenditureSum += $futureEvent->getExpenditure();
72
        }
73
74
        return $expenditureSum;
75
    }
76
77
    /**
78
     * @return Event[]
79
     */
80
    public function getEvents(): array
81
    {
82
        return $this->events;
83
    }
84
}
85