Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
FdsnToDbmi
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 __construct
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
 quake
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2namespace Dbmi\Webservice\Conversion;
3
4use Dbmi\Webservice\Quake\IdStruct as DS_QuakeId;
5use Fdsn\DataStructure\Id as DS_Id;
6
7/**
8 * Convert FDSN idQuake -> DBMI idQuake
9 * 
10 * @param Fdsn\DataStructure\Id $fdsnQuakeId QuakeID in format FDSN
11 */
12class FdsnToDbmi extends API{
13    private QuakeId $quake;
14
15    /**
16     * Constructor
17      * @param Fdsn\DataStructure\Id $fdsnQuakeId QuakeID in format FDSN
18     */
19    public function __construct(DS_Id $fdsnQuakeId){ 
20        $this->idQuake = (string)$fdsnQuakeId->value();
21        $this->from = 'hsit';
22        $this->to = 'cpti';
23    }
24
25    /**
26     * Get DBMI idQuake found (if not found a \RuntimeException is raised
27     * 
28     * @return Dbmi\Webservice\QuakeId QuakeID in DBMI format (if conversion is possible)
29     */
30    public function quake():DS_QuakeId{ 
31        if ( ! $this->replyIsSet() ) 
32            throw new \RuntimeException(sprintf("[%s] reply is not set", __METHOD__));
33
34        return new DS_QuakeId($this->reply['output']['id']); 
35    }
36}
37
38?>

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.

FdsnToDbmi->__construct
19    public function __construct(DS_Id $fdsnQuakeId){ 
20        $this->idQuake = (string)$fdsnQuakeId->value();
21        $this->from = 'hsit';
22        $this->to = 'cpti';
23    }
FdsnToDbmi->quake
31        if ( ! $this->replyIsSet() ) 
32            throw new \RuntimeException(sprintf("[%s] reply is not set", __METHOD__));
34        return new DS_QuakeId($this->reply['output']['id']); 
35    }