1 | <?php |
||
9 | class Producer |
||
10 | { |
||
11 | /** |
||
12 | * @var \DateTime |
||
13 | */ |
||
14 | private $bearing; |
||
15 | |||
16 | /** |
||
17 | * @param \DateTime|null $bearing |
||
18 | */ |
||
19 | 45 | public function __construct(\DateTime $bearing = null) |
|
23 | |||
24 | /** |
||
25 | * @return \DateTime |
||
26 | */ |
||
27 | 2 | public function getBearingDate(): \DateTime |
|
31 | |||
32 | /** |
||
33 | * Get next AIRAC date. |
||
34 | * |
||
35 | * @param \DateTime $date |
||
36 | * @return Airac |
||
37 | */ |
||
38 | 6 | public function next(\DateTime $date): Airac |
|
42 | |||
43 | /** |
||
44 | * Get next AIRAC date. |
||
45 | * |
||
46 | * @param string $number |
||
47 | * @return Airac |
||
48 | * @throws AiracNumberValidationException |
||
49 | */ |
||
50 | 13 | public function nextByNumber(string $number): Airac |
|
54 | |||
55 | /** |
||
56 | * Get current AIRAC date. |
||
57 | * |
||
58 | * @param \DateTime $date |
||
59 | * @return Airac |
||
60 | */ |
||
61 | 6 | public function now(\DateTime $date): Airac |
|
65 | |||
66 | /** |
||
67 | * Get current AIRAC date. |
||
68 | * |
||
69 | * @param string $number |
||
70 | * @return Airac |
||
71 | * @throws AiracNumberValidationException |
||
72 | */ |
||
73 | 6 | public function nowByNumber(string $number): Airac |
|
77 | |||
78 | /** |
||
79 | * Get last AIRAC date. |
||
80 | * |
||
81 | * @param \DateTime $date |
||
82 | * @return Airac |
||
83 | */ |
||
84 | 6 | public function last(\DateTime $date): Airac |
|
88 | |||
89 | /** |
||
90 | * Get last AIRAC date. |
||
91 | * |
||
92 | * @param string $number |
||
93 | * @return Airac |
||
94 | * @throws AiracNumberValidationException |
||
95 | */ |
||
96 | 6 | public function lastByNumber(string $number): Airac |
|
100 | |||
101 | /** |
||
102 | * Generator AIRAC dates. |
||
103 | * |
||
104 | * @param \DateTime $date |
||
105 | * @param $step |
||
106 | * @return Airac |
||
107 | */ |
||
108 | 36 | private function circle(\DateTime $date, int $step): Airac |
|
120 | |||
121 | /** |
||
122 | * Generator AIRAC dates. |
||
123 | * |
||
124 | * @param string $number |
||
125 | * @param int $step |
||
126 | * @return Airac |
||
127 | * @throws AiracNumberValidationException |
||
128 | */ |
||
129 | 25 | private function circleByNumber(string $number, int $step): Airac |
|
142 | |||
143 | /** |
||
144 | *Calculated number of AIRAC. |
||
145 | * |
||
146 | * @param \DateTime $date |
||
147 | * @return string |
||
148 | */ |
||
149 | 36 | private function calcNumber(\DateTime $date): string |
|
156 | } |
||
157 |