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\Range; |
| 3 | |
| 4 | use Fdsn\Webservices\Event\Data\Depth; |
| 5 | |
| 6 | /** |
| 7 | * Data structure to handle depth range. |
| 8 | * If min > max, args are swapped |
| 9 | * |
| 10 | * @param Depth $min Min depth |
| 11 | * @param Depth $max Max depth |
| 12 | * |
| 13 | */ |
| 14 | |
| 15 | class DepthRange { |
| 16 | private Depth $min; |
| 17 | private Depth $max; |
| 18 | |
| 19 | function __construct( Depth $min, Depth $max) { |
| 20 | if( $min->value() <= $max->value() ){ |
| 21 | $this->min = $min; |
| 22 | $this->max = $max; |
| 23 | } |
| 24 | else{ |
| 25 | $this->min = $max; |
| 26 | $this->max = $min; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Get min depth |
| 32 | * |
| 33 | * @return Depth Get min-Depth obj |
| 34 | */ |
| 35 | public function min():Depth { return $this->min; } |
| 36 | |
| 37 | /** |
| 38 | * Get max depth |
| 39 | * |
| 40 | * @return Depth Get max-Depth obj |
| 41 | */ |
| 42 | public function max():Depth { return $this->max; } |
| 43 | } |