Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
Total | |
85.71% |
6 / 7 |
|
83.33% |
5 / 6 |
|
83.33% |
5 / 6 |
|
83.33% |
5 / 6 |
CRAP | |
0.00% |
0 / 1 |
SingleInstance | |
85.71% |
6 / 7 |
|
83.33% |
5 / 6 |
|
83.33% |
5 / 6 |
|
83.33% |
5 / 6 |
6.17 | |
0.00% |
0 / 1 |
addFilterByEventId | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
details | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
requestId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isEventIdReplaced | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isDeleted | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
isEarthquake | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | namespace Fdsn\Webservices\Event; |
3 | |
4 | use ArrayIterator; |
5 | use IteratorAggregate; |
6 | use Traversable; |
7 | |
8 | use Fdsn\Webservices\Event\Event as Fdsnws_Webservice_Event; |
9 | |
10 | use Fdsn\Webservices\Event\Structs\Author as DS_Author; |
11 | use Fdsn\Webservices\Event\Structs\Depth as DS_Depth; |
12 | use Fdsn\Webservices\Event\Structs\Epicenter as DS_Epicenter; |
13 | use Fdsn\Webservices\Event\Structs\Id as DS_Id; |
14 | use Fdsn\Webservices\Event\Structs\LatLon as DS_LatLon; |
15 | use Fdsn\Webservices\Event\Structs\Location as DS_Location; |
16 | use Fdsn\Webservices\Event\Structs\Magnitude as DS_Magnitude; |
17 | use Fdsn\Webservices\Event\Structs\Quake as DS_Quake; |
18 | |
19 | /** |
20 | * PHP library to access FDSN Webservices and request Event (earthquake) information in text format |
21 | * @see https://www.fdsn.org/webservices/fdsnws-event-1.2.pdf FDSN official documentation |
22 | * |
23 | * @param string $format Accepted output kind format |
24 | * @param string $user Set your app name |
25 | * @param string $fdns_server Fdns webservice domain name (default: webservices.ms.ingv.it) |
26 | */ |
27 | class SingleInstance extends Fdsnws_Webservice_Event { |
28 | /* Search by eventId */ |
29 | private DS_Id $eventId; |
30 | |
31 | protected DS_Quake $event; |
32 | |
33 | |
34 | /** |
35 | * Add filter based on ID Event (see https://terremoti.ingv.it/ to get event ids) |
36 | * @param Id $eventId Unique event ID |
37 | */ |
38 | public function addFilterByEventId(DS_Id $eventId):void { |
39 | $this->eventId = $eventId; |
40 | $this->parameters['eventid'] = sprintf("eventid=%s", $this->eventId); |
41 | } |
42 | |
43 | /** |
44 | * Get event details , if only one event was found |
45 | * (filtering by eventId or when only one event is found by fetch() ) |
46 | * @return \Fdsn\Webservices\Event\Structs\Quake Quake obj |
47 | */ |
48 | public function details():DS_Quake{ return $this->event; } |
49 | |
50 | /** |
51 | * Get request event id |
52 | * |
53 | * @return \Fdsn\Webservices\Event\Structs\Id Id obj |
54 | */ |
55 | public function requestId():DS_Id{ return $this->eventId; } |
56 | |
57 | /** |
58 | * Check if event id is replaced (maybe an event is merged to another one) |
59 | * |
60 | * @return bool true if is replaced, false otherwise |
61 | */ |
62 | public function isEventIdReplaced():bool { return $this->eventId->value() !== $this->event->eventId()->value(); } |
63 | |
64 | /** |
65 | * Check if an earthquake is deleted (Shortcut for event type->isDeleted() ) |
66 | * |
67 | * @return bool true if is deleted, false otherwise |
68 | */ |
69 | public function isDeleted():bool { return $this->event->eventType()->isDeleted(); } |
70 | |
71 | /** |
72 | * Check if event type is earthquake (Shortcut for event type->isEarthquake() ) |
73 | * |
74 | * @return bool true if is deleted, false otherwise |
75 | */ |
76 | public function isEarthquake():bool { return $this->event->eventType()->isEarthquake(); } |
77 | } |
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.
38 | public function addFilterByEventId(DS_Id $eventId):void { |
39 | $this->eventId = $eventId; |
40 | $this->parameters['eventid'] = sprintf("eventid=%s", $this->eventId); |
41 | } |
48 | public function details():DS_Quake{ return $this->event; } |
69 | public function isDeleted():bool { return $this->event->eventType()->isDeleted(); } |
76 | public function isEarthquake():bool { return $this->event->eventType()->isEarthquake(); } |
62 | public function isEventIdReplaced():bool { return $this->eventId->value() !== $this->event->eventId()->value(); } |
55 | public function requestId():DS_Id{ return $this->eventId; } |