1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* For the full copyright and license information, please view the LICENSE file |
5
|
|
|
* that was distributed with this source code. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
declare ( |
9
|
|
|
strict_types = 1 |
10
|
|
|
); |
11
|
|
|
|
12
|
|
|
namespace Component\Remote\BurzeDzisNet; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Storm represents information about registered lightnings with a specified radius of monitoring |
16
|
|
|
* covered by the specified location |
17
|
|
|
* |
18
|
|
|
* Storm has properties describing: |
19
|
|
|
* - lightnings (number of cloud-end-ground lightning in specified radius for a selected location) |
20
|
|
|
* - distance (distance to the nearest registered lightning in km) |
21
|
|
|
* - direction (direction to the nearest lightning [E, E, N, NW, W, SW, S, SE]) |
22
|
|
|
* - period (number of minutes of time period containing the data [10, 15, 20 minutes]) |
23
|
|
|
* - radius (radius covered by Point in km) |
24
|
|
|
* |
25
|
|
|
* @author Krzysztof Piasecki <[email protected]> |
26
|
|
|
*/ |
27
|
|
|
class Storm implements StormInterface |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* The number of cloud-end-ground lightning in specified radius for a specified location |
31
|
|
|
* |
32
|
|
|
* @var int the number of cloud-end-ground lightning in specified radius for a specified location |
33
|
|
|
*/ |
34
|
|
|
private $lightnings = 0; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* The distance (km) to the nearest registered lightning. |
38
|
|
|
* |
39
|
|
|
* @var float distance to the nearest registered lightning |
40
|
|
|
*/ |
41
|
|
|
private $distance; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* The direction to the nearest lightning (E, E, N, NW, W, SW, S, SE). |
45
|
|
|
* |
46
|
|
|
* @var string direction to the nearest lightning |
47
|
|
|
*/ |
48
|
|
|
private $direction; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* The number of minutes of time containing the data (10, 15, 20 minutes). |
52
|
|
|
* |
53
|
|
|
* @var int number of minutes of time containing the data |
54
|
|
|
*/ |
55
|
|
|
private $period; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* The radius covered by specified location. |
59
|
|
|
* |
60
|
|
|
* @var int radius covered by specified location |
61
|
|
|
*/ |
62
|
|
|
private $radius; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* New Storm. |
66
|
|
|
* |
67
|
|
|
* @param int $lightnings number of cloud-end-ground lightning in specified radius for a selected location |
68
|
|
|
* @param float $distance distance (km) to the nearest registered lightning |
69
|
|
|
* @param string $direction direction to the nearest lightning (E, E, N, NW, W, SW, S, SE) |
70
|
|
|
* @param int $period number of minutes of time containing the data (10, 15, 20 minutes) |
71
|
|
|
* @param int $radius radius covered by the location |
72
|
|
|
*/ |
73
|
|
|
public function __construct(int $lightnings, float $distance, string $direction, int $period, int $radius) |
74
|
|
|
{ |
75
|
|
|
$this->lightnings = $lightnings; |
76
|
|
|
$this->distance = $distance; |
77
|
|
|
$this->direction = $direction; |
78
|
|
|
$this->period = $period; |
79
|
|
|
$this->radius = $radius; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Get the number of cloud-end-ground lightning in specified radius for a selected location |
84
|
|
|
* |
85
|
|
|
* @return int number of cloud-end-ground lightning in specified radius for a selected location |
86
|
|
|
*/ |
87
|
|
|
public function lightnings(): int |
88
|
|
|
{ |
89
|
|
|
return $this->lightnings; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Get the distance to the nearest registered lightning |
94
|
|
|
* |
95
|
|
|
* @return float distance to the nearest registered lightning |
96
|
|
|
*/ |
97
|
|
|
public function distance(): float |
98
|
|
|
{ |
99
|
|
|
return $this->distance; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Get direction to the nearest lightning (E, E, N, NW, W, SW, S, SE) |
104
|
|
|
* |
105
|
|
|
* @return string direction to the nearest lightning |
106
|
|
|
*/ |
107
|
|
|
public function direction(): string |
108
|
|
|
{ |
109
|
|
|
return $this->direction; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Get the number of minutes of time containing the data (10, 15, 20 minutes) |
114
|
|
|
* |
115
|
|
|
* @return int number of minutes of time containing the data |
116
|
|
|
*/ |
117
|
|
|
public function period(): int |
118
|
|
|
{ |
119
|
|
|
return $this->period; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Get radius covered by specified location |
124
|
|
|
* |
125
|
|
|
* @return int radius covered by location |
126
|
|
|
*/ |
127
|
|
|
public function radius(): int |
128
|
|
|
{ |
129
|
|
|
return $this->radius; |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|