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
85.71% covered (warning)
85.71%
6 / 7
100.00% covered (success)
100.00%
6 / 6
CRAP
100.00% covered (success)
100.00%
1 / 1
Epicenter
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
8 / 8
85.71% covered (warning)
85.71%
6 / 7
100.00% covered (success)
100.00%
6 / 6
7.14
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
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
 __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%
3 / 3
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
 point
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
 depth
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
 equals
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
3 / 3
50.00% covered (danger)
50.00%
1 / 2
100.00% covered (success)
100.00%
1 / 1
2.50
1<?php
2namespace Fdsn\Webservices\Event\Structs;
3
4/**
5 * Data structure to handle epicenters
6 * 
7 * @param LatLon $point         LatLon obj
8 * @param Depth $depth            Depth obj
9 */
10class Epicenter {
11    private LatLon $point;
12    private Depth $depth;
13
14    function __construct( LatLon $point, Depth $depth) {
15        $this->point = $point;
16        $this->depth = $depth;
17    }
18
19    function __destruct(){ }
20
21    /**
22     * Returns epicenter in lat, lon, depth readable format
23     *
24     * @return string  lat, lon, depth ("%.5f,%.5f, %.2f km")
25     */
26    function __toString(){
27        return sprintf("%s, %s", 
28            $this->point, 
29            $this->depth);
30    }
31
32    /**
33     * Get epicenter coordinates
34     *
35     * @return LatLon     epicenter coordinates
36     */
37    public function point():LatLon { return $this->point; }
38
39    /**
40     * Get epicenter depth
41     *
42     * @return Depth     epicenter depth
43     */
44    public function depth():Depth { return $this->depth; }
45
46    /**
47     * Compare two objects
48     * @return bool        true are equals, false otherwise
49     */
50    public function equals(self $other):bool{ return $this->point == $other->point && $this->depth == $other->depth; }
51}