Conditions | 2 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
31 | public function from(RestResource $resource): string |
||
32 | { |
||
33 | $xml = new SimpleXMLElement(sprintf( |
||
34 | '<?xml version="1.0"?><%s />', |
||
35 | $resource->name() |
||
36 | )); |
||
37 | try { |
||
38 | $this->toSimpleXML( |
||
39 | $resource->body() + $this->linksOf($resource, $this->baseUri), |
||
40 | $xml |
||
41 | ); |
||
42 | return (string) $xml->asXML(); |
||
43 | } catch (Throwable $exception) { |
||
44 | throw CannotFormatXml::because($resource, $exception); |
||
45 | } |
||
55 |