1 | <?php |
||
32 | class ConfigurationUtils |
||
33 | { |
||
34 | |||
35 | /** |
||
36 | * The instance. |
||
37 | * |
||
38 | * @var \AppserverIo\Configuration\ConfigurationUtils |
||
39 | */ |
||
40 | protected static $instance; |
||
41 | |||
42 | /** |
||
43 | * Protected constructor to avoid direct instanciation. |
||
44 | */ |
||
45 | 1 | protected function __construct() |
|
48 | |||
49 | /** |
||
50 | * Creates a singleton instance of the utility class. |
||
51 | * |
||
52 | * @return \AppserverIo\Configuration\ConfigurationUtils The singleton instance |
||
53 | */ |
||
54 | 3 | public static function singleton() |
|
65 | |||
66 | /** |
||
67 | * Will return recently found errors already formatted for output |
||
68 | * |
||
69 | * @param array $errors An array with error messages |
||
70 | * |
||
71 | * @return array The array with the formatted error messages |
||
72 | */ |
||
73 | 1 | protected function prepareErrorMessages($errors) |
|
88 | |||
89 | /** |
||
90 | * Will validate a given file against a schema. This method supports several validation |
||
91 | * mechanisms for different file types. Will return TRUE if validation passes, FALSE |
||
92 | * otherwise. |
||
93 | * |
||
94 | * @param string $fileName Name of the file to validate |
||
95 | * @param string $schemaFile The specific schema file to validate against |
||
96 | * @param boolean $failOnErrors If the validation should fail on error (optional) |
||
97 | * |
||
98 | * @return void |
||
99 | * |
||
100 | * @throws \AppserverIo\Configuration\ConfigurationException If aren't able to validate this file type |
||
101 | */ |
||
102 | 3 | public function validateFile($fileName, $schemaFile, $failOnErrors = false) |
|
130 | |||
131 | /** |
||
132 | * Will validate a DOM document against a schema file. Will return TRUE if validation |
||
133 | * passes, FALSE otherwise. |
||
134 | * |
||
135 | * @param \DOMDocument $domDocument DOM document to validate |
||
136 | * @param string $schemaFile The specific schema file to validate against |
||
137 | * @param boolean $failOnErrors If the validation should fail on error (optional) |
||
138 | * |
||
139 | * @return void |
||
140 | * |
||
141 | * @throws \AppserverIo\Configuration\ConfigurationException If $failOnErrors is set to true an exception will be thrown on errors |
||
142 | */ |
||
143 | 2 | public function validateXml(\DOMDocument $domDocument, $schemaFile, $failOnErrors = false) |
|
163 | } |
||
164 |