Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
Total | |
100.00% |
11 / 11 |
|
100.00% |
8 / 8 |
|
100.00% |
6 / 6 |
|
100.00% |
5 / 5 |
CRAP | |
100.00% |
1 / 1 |
RadiusRange | |
100.00% |
11 / 11 |
|
100.00% |
8 / 8 |
|
100.00% |
6 / 6 |
|
100.00% |
5 / 5 |
6 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
5 / 5 |
|
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
__destruct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
__toString | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
min | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
max | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Fdsn\Webservices\Event\Structs; |
3 | |
4 | /** |
5 | * Data structure to handle Radius range |
6 | * |
7 | * @param Radius $min Min radius |
8 | * @param Radius $max Max radius |
9 | */ |
10 | class RadiusRange { |
11 | private Radius $min; |
12 | private Radius $max; |
13 | |
14 | function __construct( Radius $min, Radius $max) { |
15 | if( $min->value() <= $max->value() ) { |
16 | $this->min = $min; |
17 | $this->max = $max; |
18 | } |
19 | else{ |
20 | $this->min = $max; |
21 | $this->max = $min; |
22 | } |
23 | } |
24 | |
25 | function __destruct(){ } |
26 | |
27 | /** |
28 | * Returns bounding box coordinates |
29 | * |
30 | * @return string Radius range in [%.2f,%.2f] [min radius, max radius] format |
31 | */ |
32 | function __toString(){ |
33 | return sprintf("[%.2f,%.2f]", |
34 | $this->min->value(), |
35 | $this->max->value()); |
36 | } |
37 | |
38 | /** |
39 | * Get min radius |
40 | * |
41 | * @return Radius Min radius |
42 | */ |
43 | public function min():Radius { return $this->min; } |
44 | |
45 | /** |
46 | * Get max radius |
47 | * |
48 | * @return Radius Max radius |
49 | */ |
50 | public function max():Radius { return $this->max; } |
51 | |
52 | } |