Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| DepthRange | |
100.00% |
7 / 7 |
|
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
5 / 5 |
|
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| 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 depth range. |
| 6 | * If min > max, args are swapped |
| 7 | * |
| 8 | * @param Depth $min Min depth |
| 9 | * @param Depth $max Max depth |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | class DepthRange { |
| 14 | private Depth $min; |
| 15 | private Depth $max; |
| 16 | |
| 17 | function __construct( Depth $min, Depth $max) { |
| 18 | if( $min->value() <= $max->value() ){ |
| 19 | $this->min = $min; |
| 20 | $this->max = $max; |
| 21 | } |
| 22 | else{ |
| 23 | $this->min = $max; |
| 24 | $this->max = $min; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Get min depth |
| 30 | * |
| 31 | * @return Depth Get min-Depth obj |
| 32 | */ |
| 33 | public function min():Depth { return $this->min; } |
| 34 | |
| 35 | /** |
| 36 | * Get max depth |
| 37 | * |
| 38 | * @return Depth Get max-Depth obj |
| 39 | */ |
| 40 | public function max():Depth { return $this->max; } |
| 41 | } |