Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
1 / 1
Radius
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
5 / 5
7
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
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
 value
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
 isValid
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2namespace Fdsn\Webservices\Event\Structs;
3
4/**
5 * Data structure to handle Latitude,Longitude point
6 *
7 * @param float $radius            Radius value (0 ~ 180)
8 */
9class Radius {
10    private float $value;
11
12    private $validRadius = array('min' => 0, 'max' => 180);
13
14    function __construct( float $value) {
15
16        if( ! $this->isValid($value) )
17            throw new \InvalidArgumentException("Radius invalid");
18
19        $this->value = $value;
20    }
21
22    function __destruct(){ }
23
24    function __toString(){ return sprintf("%.2f", $this->value); }
25
26    /**
27     * Get radius value
28     *
29     * @return float radius
30     */
31    public function value():float { return $this->value; }
32
33    /**
34     * Check radius validity
35     *
36     * @return bool True if is valid, false otherwise
37     */
38    private function isValid(float $value){ return ($this->validRadius['min'] <= $value && $value <= $this->validRadius['max']); }
39} 

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.

Radius->__construct
14    function __construct( float $value) {
15
16        if( ! $this->isValid($value) )
17            throw new \InvalidArgumentException("Radius invalid");
19        $this->value = $value;
20    }
Radius->__destruct
22    function __destruct(){ }
Radius->__toString
24    function __toString(){ return sprintf("%.2f", $this->value); }
Radius->isValid
38    private function isValid(float $value){ return ($this->validRadius['min'] <= $value && $value <= $this->validRadius['max']); }
38    private function isValid(float $value){ return ($this->validRadius['min'] <= $value && $value <= $this->validRadius['max']); }
38    private function isValid(float $value){ return ($this->validRadius['min'] <= $value && $value <= $this->validRadius['max']); }
Radius->value
31    public function value():float { return $this->value; }