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