| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 18 | 8 | public function fromStr(string $reference): XmlInjectable |
|
| 19 | { |
||
| 20 | 8 | $parts = explode('/', $reference); |
|
| 21 | 8 | if (count($parts) !== 4) { |
|
| 22 | 1 | throw new \Exception('Could not extract service parameters. Invalid format.'); |
|
| 23 | } |
||
| 24 | |||
| 25 | $fragment = <<<EOD |
||
| 26 | <xrd:client id:objectType="SUBSYSTEM" |
||
| 27 | xmlns:xrd="http://x-road.eu/xsd/xroad.xsd" |
||
| 28 | xmlns:id="http://x-road.eu/xsd/identifiers"> |
||
| 29 | 7 | <id:xRoadInstance>{$parts[0]}</id:xRoadInstance> |
|
| 30 | 7 | <id:memberClass>{$parts[1]}</id:memberClass> |
|
| 31 | 7 | <id:memberCode>{$parts[2]}</id:memberCode> |
|
| 32 | 7 | <id:subsystemCode>{$parts[3]}</id:subsystemCode> |
|
| 33 | </xrd:client> |
||
| 34 | EOD; |
||
| 35 | |||
| 36 | 7 | return new FragmentInjection( |
|
| 37 | 7 | 'http://schemas.xmlsoap.org/soap/envelope/', |
|
| 38 | 7 | 'Header', |
|
| 39 | 7 | $fragment |
|
| 40 | ); |
||
| 43 |