Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
85.71% covered (warning)
85.71%
6 / 7
83.33% covered (warning)
83.33%
5 / 6
83.33% covered (warning)
83.33%
5 / 6
83.33% covered (warning)
83.33%
5 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
SingleInstance
85.71% covered (warning)
85.71%
6 / 7
83.33% covered (warning)
83.33%
5 / 6
83.33% covered (warning)
83.33%
5 / 6
83.33% covered (warning)
83.33%
5 / 6
6.17
0.00% covered (danger)
0.00%
0 / 1
 addFilterByEventId
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
 details
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
 requestId
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 isEventIdReplaced
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
 isDeleted
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
 isEarthquake
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 ArrayIterator;
5use IteratorAggregate;
6use Traversable;
7
8use Fdsn\Webservices\Event\Event as Fdsnws_Webservice_Event;
9
10use Fdsn\Webservices\Event\Structs\Author as DS_Author;
11use Fdsn\Webservices\Event\Structs\Depth as DS_Depth;
12use Fdsn\Webservices\Event\Structs\Epicenter as DS_Epicenter;
13use Fdsn\Webservices\Event\Structs\Id as DS_Id;
14use Fdsn\Webservices\Event\Structs\LatLon as DS_LatLon;
15use Fdsn\Webservices\Event\Structs\Location as DS_Location;
16use Fdsn\Webservices\Event\Structs\Magnitude as DS_Magnitude;
17use 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 */
27class 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}

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.

SingleInstance->addFilterByEventId
38    public function addFilterByEventId(DS_Id $eventId):void { 
39        $this->eventId = $eventId; 
40        $this->parameters['eventid'] = sprintf("eventid=%s", $this->eventId);
41    }
SingleInstance->details
48        public function details():DS_Quake{ return $this->event; }
SingleInstance->isDeleted
69        public function isDeleted():bool { return $this->event->eventType()->isDeleted(); }
SingleInstance->isEarthquake
76        public function isEarthquake():bool { return $this->event->eventType()->isEarthquake(); }
SingleInstance->isEventIdReplaced
62        public function isEventIdReplaced():bool { return $this->eventId->value() !== $this->event->eventId()->value(); }
SingleInstance->requestId
55        public function requestId():DS_Id{ return $this->eventId; }