Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
MagnitudeRange
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
5 / 5
6
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
5 / 5
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
 __destruct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 __toString
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 min
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 max
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2namespace Fdsn\Webservices\Event\Structs;
3
4/**
5 * Data structure to handle magnitude range
6 *
7 * @param Magnitude $min    Min magnitude
8 * @param Magnitude $max    Max magnitude
9 *
10 * @return true, if every check is passed, false otherwise
11 */
12
13class MagnitudeRange {
14    private Magnitude $min;
15    private Magnitude $max;
16
17    function __construct( Magnitude $min, Magnitude $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    function __destruct(){ }
29
30    /**
31     * Returns magnitude range
32     *
33     * @return string [%s %.1f, %s%.1f] [min type value, max type value] format
34     */
35    function __toString(){ return sprintf("[%s, %s]", $this->min, $this->max); }
36
37    /**
38     * Get min magnitude obj
39     *
40     * @return Magnitude get min Magnitude obj
41     */
42    public function min():Magnitude { return $this->min; }
43
44    /**
45     * Get max magnitude obj
46     *
47     * @return Magnitude get max Magnitude obj
48     */
49    public function max():Magnitude { return $this->max; }
50} 

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

MagnitudeRange->__construct
17    function __construct( Magnitude $min, Magnitude $max) {
18        if( $min->value() <= $max->value() ){
18        if( $min->value() <= $max->value() ){
19            $this->min = $min;
23            $this->min = $max;
24            $this->max = $min;
25        }
26    }
26    }
MagnitudeRange->__destruct
28    function __destruct(){ }
MagnitudeRange->__toString
35    function __toString(){ return sprintf("[%s, %s]", $this->min, $this->max); }
MagnitudeRange->max
49    public function max():Magnitude { return $this->max; }
MagnitudeRange->min
42    public function min():Magnitude { return $this->min; }