Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
25 / 25
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
12 / 12
CRAP
100.00% covered (success)
100.00%
1 / 1
EventData
100.00% covered (success)
100.00%
25 / 25
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
12 / 12
12
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
7 / 7
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%
8 / 8
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
 eventId
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
 originTimeObj
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
 originTimeUTC
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
 originTimeUTCISO8601
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
 magnitude
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
 epicenter
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
 location
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
 author
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
 eventType
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;
3
4use Fdsn\Webservices\Event\Data\Author;
5use Fdsn\Webservices\Event\Data\Depth;
6use Fdsn\Webservices\Event\Data\Epicenter;
7use Fdsn\Webservices\Event\Data\EventType;
8use Fdsn\Webservices\Event\Data\Id;
9use Fdsn\Webservices\Event\Data\LatLon;
10use Fdsn\Webservices\Event\Data\Location;
11use Fdsn\Webservices\Event\Data\Magnitude;
12use Fdsn\Webservices\Event\Data\Radius;
13
14/**
15 * Data structure to handle information about earthquakes
16 * This object must be instantiated only with quake data
17 * 
18 * @param Fdsn\Webservices\Event\Data\Id $eventId        EventID according to INGV ONT ID (see https://terremoti.ingv.it/)
19 * @param \DateTime|null    $originTimeUTC        Quake UTC origin time, in ISO 8601 format (see: date('c'))
20 * @param Fdsn\Webservices\Event\Data\Location|null     $location        Where the quake origin is
21 * @param Fdsn\Webservices\Event\Data\Magnitude|null     $magnitude        Magnitude obj
22 * @param Fdsn\Webservices\Event\Data\Epicenter|null     $epicenter         Epicenter obj
23 * @param Fdsn\Webservices\Event\Data\Author|null         $author            Author obj
24 * @param Fdsn\Webservices\Event\Data\EventType|null    $eventType        EventType obj
25 */
26class EventData {
27    private Id $eventId;
28    private \DateTime $originTimeUTC;
29    private Location  $location;
30    private Magnitude $magnitude;
31    private Epicenter $epicenter;
32    private Author $author;
33    private EventType $eventType;
34
35    function __construct(
36        Id    $eventId,
37        \DateTime $originTimeUTC,
38        Location  $location,
39        Magnitude $magnitude,
40        Epicenter $epicenter,
41        ?Author    $author = null,
42        ?EventType $eventType = null) {
43
44        $this->eventId = $eventId;
45        $this->originTimeUTC = $originTimeUTC;
46        $this->location = $location;
47        $this->magnitude = $magnitude;
48        $this->epicenter = $epicenter;
49        $this->author = $author;
50        $this->eventType = $eventType;
51    }
52
53    function __destruct(){ }
54
55    /**
56     * Returns quake details
57     *
58     * @return string Quake details: eventId, originTimeUTC, magnitude, epicenter, location
59     */
60    function __toString(){
61        return sprintf("Quake ID %s, on %s, mag: %s, origin: %s, location: %s, type: %s)",
62            $this->eventId,  //it's already converted to int in Id::__toString()
63            $this->originTimeUTC(), 
64            $this->magnitude,
65            $this->epicenter,
66            $this->location,
67            $this->eventType
68        );
69    }
70
71    /**
72     * Get event ID
73     *
74     * @return Id Event ID
75     */
76    public function eventId():Id { return $this->eventId; }
77
78    /**
79     * Get origin time as DateTime obj
80     *
81     * @return \DateTime origin time as DateTime obj
82     */
83    public function originTimeObj():\DateTime{ return $this->originTimeUTC; }
84
85    /**
86     * Get UTC origin time
87     *
88     * @return int UTC Origin time in YYYY-mm-ddTHH:mm:ss
89     */
90    public function originTimeUTC():string { return $this->originTimeUTC->format('Y-m-d\TH:i:s'); }
91
92    /**
93     * Get UTC origin time
94     *
95     * @return int UTC Origin time in YYYY-mm-ddTHH:mm:ss
96     */
97    public function originTimeUTCISO8601():string { return $this->originTimeUTC->format('c'); }
98
99    /**
100     * Get magnitude
101     *
102     * @return Magnitude Magnitude obj
103     */
104    public function magnitude():Magnitude { return $this->magnitude; }
105
106    /**
107     * Get epicenter
108     *
109     * @return Epicenter Epicenter obj
110     */
111    public function epicenter():Epicenter { return $this->epicenter; }
112
113    /**
114     * Get location
115     *
116     * @return Location Location obj
117     */
118    public function location():Location { return $this->location; }
119
120    /**
121     * Get author
122     *
123     * @return Author Author obj
124     */
125    public function author():?Author { return $this->author; }
126
127    /**
128     * Get event type
129     *
130     * @return EventType EventType obj
131     */
132    public function eventType():?EventType{ return $this->eventType; }
133}

Paths

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

EventData->__construct
35    function __construct(
36        Id    $eventId,
37        \DateTime $originTimeUTC,
38        Location  $location,
39        Magnitude $magnitude,
40        Epicenter $epicenter,
41        ?Author    $author = null,
42        ?EventType $eventType = null) {
43
44        $this->eventId = $eventId;
45        $this->originTimeUTC = $originTimeUTC;
46        $this->location = $location;
47        $this->magnitude = $magnitude;
48        $this->epicenter = $epicenter;
49        $this->author = $author;
50        $this->eventType = $eventType;
51    }
EventData->__destruct
53    function __destruct(){ }
EventData->__toString
61        return sprintf("Quake ID %s, on %s, mag: %s, origin: %s, location: %s, type: %s)",
62            $this->eventId,  //it's already converted to int in Id::__toString()
63            $this->originTimeUTC(), 
64            $this->magnitude,
65            $this->epicenter,
66            $this->location,
67            $this->eventType
68        );
69    }
EventData->author
125    public function author():?Author { return $this->author; }
EventData->epicenter
111    public function epicenter():Epicenter { return $this->epicenter; }
EventData->eventId
76    public function eventId():Id { return $this->eventId; }
EventData->eventType
132    public function eventType():?EventType{ return $this->eventType; }
EventData->location
118    public function location():Location { return $this->location; }
EventData->magnitude
104    public function magnitude():Magnitude { return $this->magnitude; }
EventData->originTimeObj
83    public function originTimeObj():\DateTime{ return $this->originTimeUTC; }
EventData->originTimeUTC
90    public function originTimeUTC():string { return $this->originTimeUTC->format('Y-m-d\TH:i:s'); }
EventData->originTimeUTCISO8601
97    public function originTimeUTCISO8601():string { return $this->originTimeUTC->format('c'); }