| Total Complexity | 5 |
| Total Lines | 45 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 9 | abstract class XmlFormatter implements ResourceFormatter |
||
| 10 | { |
||
| 11 | use LinkRetrieval; |
||
| 12 | |||
| 13 | /** @var string */ |
||
| 14 | private $baseUri; |
||
| 15 | /** @var Singularizer */ |
||
| 16 | protected $singularizer; |
||
| 17 | |||
| 18 | public function __construct(string $baseUri, Singularizer $singularizer = null) |
||
| 19 | { |
||
| 20 | $this->baseUri = $baseUri; |
||
| 21 | $this->singularizer = $singularizer ?: BoogieSingularizer::default(); |
||
| 22 | } |
||
| 23 | |||
| 24 | public static function in( |
||
| 25 | string $locale, |
||
| 26 | string $baseUri |
||
| 27 | ): ResourceFormatter { |
||
| 28 | return new static($baseUri, BoogieSingularizer::in($locale)); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function from(RestResource $resource): string |
||
| 45 | } |
||
| 46 | } |
||
| 47 | |||
| 48 | // @todo inject serializer instead |
||
| 49 | abstract protected function toSimpleXML( |
||
| 50 | array $input, |
||
| 51 | SimpleXMLElement $parent, |
||
| 52 | bool $alreadySingularized = false |
||
| 53 | ): void; |
||
| 54 | } |
||
| 55 |