|
1 | 1 | <?php |
2 | 2 | namespace phpbu\App\Configuration\Loader; |
3 | 3 |
|
| 4 | +use DOMDocument; |
4 | 5 | use DOMElement; |
5 | 6 | use DOMXPath; |
6 | 7 | use phpbu\App\Configuration; |
7 | 8 | use phpbu\App\Configuration\Loader; |
8 | 9 | use phpbu\App\Exception; |
9 | 10 | use phpbu\App\Util\Str; |
10 | 11 |
|
| 12 | +use function defined; |
| 13 | +use function libxml_clear_errors; |
| 14 | +use function libxml_get_errors; |
| 15 | +use function libxml_use_internal_errors; |
| 16 | +use function trim; |
| 17 | + |
11 | 18 | /** |
12 | 19 | * Loader for a phpbu XML configuration file. |
13 | 20 | * |
14 | 21 | * Example XML configuration file: |
15 | 22 | * <code> |
16 | 23 | * <?xml version="1.0" encoding="UTF-8" ?> |
17 | 24 | * <phpbu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
18 | | - * xsi:noNamespaceSchemaLocation="http://schema.phpbu.de/1.1/phpbu.xsd" |
| 25 | + * xsi:noNamespaceSchemaLocation="https://www.phpbu.de/schema/1.1/phpbu.xsd" |
19 | 26 | * bootstrap="backup/bootstrap.php" |
20 | 27 | * verbose="true"> |
21 | 28 | * |
@@ -375,7 +382,7 @@ protected function getOptions(DOMElement $node) |
375 | 382 | private function loadXmlFile($filename) |
376 | 383 | { |
377 | 384 | $contents = $this->loadFile($filename); |
378 | | - $document = new \DOMDocument; |
| 385 | + $document = new DOMDocument; |
379 | 386 | $message = ''; |
380 | 387 | $internal = libxml_use_internal_errors(true); |
381 | 388 | $reporting = error_reporting(0); |
@@ -409,19 +416,19 @@ private function loadXmlFile($filename) |
409 | 416 | */ |
410 | 417 | private function validateConfigurationAgainstSchema() |
411 | 418 | { |
412 | | - $original = \libxml_use_internal_errors(true); |
| 419 | + $original = libxml_use_internal_errors(true); |
413 | 420 | $xsdFilename = __DIR__ . '/../../../phpbu.xsd'; |
414 | | - if (\defined('__PHPBU_PHAR_ROOT__')) { |
| 421 | + if (defined('__PHPBU_PHAR_ROOT__')) { |
415 | 422 | $xsdFilename = __PHPBU_PHAR_ROOT__ . '/phpbu.xsd'; |
416 | 423 | } |
417 | 424 | $this->document->schemaValidate($xsdFilename); |
418 | | - foreach (\libxml_get_errors() as $error) { |
| 425 | + foreach (libxml_get_errors() as $error) { |
419 | 426 | if (!isset($this->errors[$error->line])) { |
420 | 427 | $this->errors[$error->line] = []; |
421 | 428 | } |
422 | | - $this->errors[$error->line][] = \trim($error->message); |
| 429 | + $this->errors[$error->line][] = trim($error->message); |
423 | 430 | } |
424 | | - \libxml_clear_errors(); |
425 | | - \libxml_use_internal_errors($original); |
| 431 | + libxml_clear_errors(); |
| 432 | + libxml_use_internal_errors($original); |
426 | 433 | } |
427 | 434 | } |
0 commit comments