Conditions | 3 |
Paths | 1 |
Total Lines | 19 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 3.0175 |
Changes | 0 |
1 | <?php |
||
37 | 1 | private function loadXmlDocument($source, $contentType, $options) { |
|
38 | 1 | return (new Errors())->capture( |
|
39 | 1 | function () use ($source, $contentType, $options) { |
|
40 | 1 | $document = new Document(); |
|
41 | 1 | $document->preserveWhiteSpace = FALSE; |
|
42 | 1 | $settings = $this->getOptions($options); |
|
43 | 1 | $settings->isAllowed($sourceType = $settings->getSourceType($source)); |
|
44 | switch ($sourceType) { |
||
45 | 1 | case Options::IS_FILE : |
|
46 | $document->load($source, $settings[Options::LIBXML_OPTIONS]); |
||
47 | break; |
||
48 | 1 | case Options::IS_STRING : |
|
49 | 1 | default : |
|
50 | 1 | $document->loadXML($source, $settings[Options::LIBXML_OPTIONS]); |
|
51 | 1 | } |
|
52 | 1 | return $document; |
|
53 | } |
||
54 | 1 | ); |
|
55 | } |
||
56 | } |
||
57 | } |