Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
Total | |
100.00% |
11 / 11 |
|
90.00% |
9 / 10 |
|
57.14% |
4 / 7 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
MultiInstance | |
100.00% |
11 / 11 |
|
90.00% |
9 / 10 |
|
57.14% |
4 / 7 |
|
100.00% |
4 / 4 |
8.83 | |
100.00% |
1 / 1 |
rawXMLContributors | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
DOMContributors | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
fetch | |
100.00% |
3 / 3 |
|
75.00% |
3 / 4 |
|
50.00% |
1 / 2 |
|
100.00% |
1 / 1 |
2.50 | |||
parse | |
100.00% |
6 / 6 |
|
100.00% |
4 / 4 |
|
33.33% |
1 / 3 |
|
100.00% |
1 / 1 |
3.19 |
1 | <?php |
2 | namespace Fdsn\Webservices\Contributor; |
3 | |
4 | use Fdsn\Webservices\Webservice as Fdsnws_Webservice; |
5 | |
6 | /** |
7 | * PHP library to access FDSN Webservices and request Contributors |
8 | */ |
9 | class MultiInstance extends Fdsnws_Webservice { |
10 | |
11 | private string $xmlResults; |
12 | private \DOMDocument $DOMResults; |
13 | |
14 | /** |
15 | * Get RAW Contributors XML String |
16 | * @return string Get RAW Contributors XML String |
17 | */ |
18 | public function rawXMLContributors():string { return $this->xmlResults; } |
19 | |
20 | /** |
21 | * Get Contributors parsed in a DOM Document |
22 | * @return \DOMDocument Get Contributors parsed in a DOMDocument |
23 | */ |
24 | public function DOMContributors():\DOMDocument{ return $this->DOMResults; } |
25 | |
26 | /** |
27 | * Fetch contributors (xml document) from selected FDSN server |
28 | * |
29 | * @return int number of catalogs found |
30 | */ |
31 | public function fetch():int { |
32 | $xmlResponse = $this->getFetch($this->webserviceFullPath . '/contributors'); |
33 | |
34 | $this->xmlResults = ( $this->parse($xmlResponse) > 0 ) ? $xmlResponse : ''; |
35 | |
36 | return $this->numRows(); |
37 | } |
38 | |
39 | /** |
40 | * Parse XML Contributors and store it into a DOM Document AND all values found into an Iterable array |
41 | * |
42 | * @return int number of contributors found |
43 | */ |
44 | private function parse(string $xmlResponse):int{ |
45 | $this->DOMResults = new \DOMDocument('1.0', 'UTF-8'); |
46 | $this->DOMResults->loadXML($xmlResponse); |
47 | |
48 | $contributors = $this->DOMResults->getElementsByTagName('Contributor'); |
49 | foreach($contributors as $name) |
50 | $this->arrayOfResults[] = new Struct(trim($name->nodeValue)); |
51 | |
52 | return $this->numRows(); |
53 | } |
54 | } |
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.
24 | public function DOMContributors():\DOMDocument{ return $this->DOMResults; } |
32 | $xmlResponse = $this->getFetch($this->webserviceFullPath . '/contributors'); |
33 | |
34 | $this->xmlResults = ( $this->parse($xmlResponse) > 0 ) ? $xmlResponse : ''; |
34 | $this->xmlResults = ( $this->parse($xmlResponse) > 0 ) ? $xmlResponse : ''; |
34 | $this->xmlResults = ( $this->parse($xmlResponse) > 0 ) ? $xmlResponse : ''; |
35 | |
36 | return $this->numRows(); |
37 | } |
32 | $xmlResponse = $this->getFetch($this->webserviceFullPath . '/contributors'); |
33 | |
34 | $this->xmlResults = ( $this->parse($xmlResponse) > 0 ) ? $xmlResponse : ''; |
34 | $this->xmlResults = ( $this->parse($xmlResponse) > 0 ) ? $xmlResponse : ''; |
34 | $this->xmlResults = ( $this->parse($xmlResponse) > 0 ) ? $xmlResponse : ''; |
35 | |
36 | return $this->numRows(); |
37 | } |
44 | private function parse(string $xmlResponse):int{ |
45 | $this->DOMResults = new \DOMDocument('1.0', 'UTF-8'); |
46 | $this->DOMResults->loadXML($xmlResponse); |
47 | |
48 | $contributors = $this->DOMResults->getElementsByTagName('Contributor'); |
49 | foreach($contributors as $name) |
49 | foreach($contributors as $name) |
49 | foreach($contributors as $name) |
50 | $this->arrayOfResults[] = new Struct(trim($name->nodeValue)); |
49 | foreach($contributors as $name) |
49 | foreach($contributors as $name) |
50 | $this->arrayOfResults[] = new Struct(trim($name->nodeValue)); |
51 | |
52 | return $this->numRows(); |
53 | } |
44 | private function parse(string $xmlResponse):int{ |
45 | $this->DOMResults = new \DOMDocument('1.0', 'UTF-8'); |
46 | $this->DOMResults->loadXML($xmlResponse); |
47 | |
48 | $contributors = $this->DOMResults->getElementsByTagName('Contributor'); |
49 | foreach($contributors as $name) |
49 | foreach($contributors as $name) |
49 | foreach($contributors as $name) |
50 | $this->arrayOfResults[] = new Struct(trim($name->nodeValue)); |
51 | |
52 | return $this->numRows(); |
53 | } |
44 | private function parse(string $xmlResponse):int{ |
45 | $this->DOMResults = new \DOMDocument('1.0', 'UTF-8'); |
46 | $this->DOMResults->loadXML($xmlResponse); |
47 | |
48 | $contributors = $this->DOMResults->getElementsByTagName('Contributor'); |
49 | foreach($contributors as $name) |
49 | foreach($contributors as $name) |
50 | $this->arrayOfResults[] = new Struct(trim($name->nodeValue)); |
51 | |
52 | return $this->numRows(); |
53 | } |
18 | public function rawXMLContributors():string { return $this->xmlResults; } |