Completed
Push — feature/multi_order ( eb7707 )
by Laurent
01:37
created

GetPilotsWithMissionsQuery::isPilotsOnly()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 *
4
 */
5
6
namespace flightlog\query;
7
8
use Webmozart\Assert\Assert;
9
10
/**
11
 * @author Laurent De Coninck <[email protected]>
12
 */
13
class GetPilotsWithMissionsQuery
14
{
15
16
    /**
17
     * @var int
18
     */
19
    private $year;
20
21
    /**
22
     * @var int
23
     */
24
    private $quarter;
25
26
    /**
27
     * @param int $year
28
     * @param int $quarter
29
     */
30
    public function __construct($year, $quarter = null)
31
    {
32
        Assert::integerish($year);
33
        Assert::greaterThan($year, 0);
34
35
        Assert::nullOrIntegerish($quarter);
36
        if ($quarter !== null) {
37
            Assert::greaterThan($quarter, 0);
38
            Assert::lessThanEq($quarter, 4);
39
40
        }
41
42
        $this->quarter = (int) $quarter;
43
        $this->year = (int) $year;
44
    }
45
46
    /**
47
     * @return int
48
     */
49
    public function getYear()
50
    {
51
        return $this->year;
52
    }
53
54
    /**
55
     * @return int
56
     */
57
    public function getQuarter()
58
    {
59
        return $this->quarter;
60
    }
61
62
    /**
63
     * @return bool
64
     */
65
    public function hasQuarter()
66
    {
67
        return !empty($this->quarter);
68
    }
69
70
    /**
71
     * @return bool
72
     */
73
    public function isPilotsOnly()
74
    {
75
        return $this->hasQuarter();
76
    }
77
}
78