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 |
| FdsnToDbmi | |
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 DS_Id; |
| 6 | |
| 7 | /** |
| 8 | * Convert FDSN idQuake -> DBMI idQuake |
| 9 | * |
| 10 | * @param Fdsn\Webservices\Event\Structs\Id $fdsnQuakeId QuakeID in format FDSN |
| 11 | */ |
| 12 | class FdsnToDbmi extends API{ |
| 13 | private QuakeId $quake; |
| 14 | |
| 15 | /** |
| 16 | * Constructor |
| 17 | * @param Fdsn\Webservices\Event\Structs\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 | ?> |