File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,12 @@ interface SchemaValidatableElementInterface extends ElementInterface
1616 /**
1717 * Validate the given DOMDocument against the schema set for this element
1818 *
19+ * @param \DOMDocument $document
20+ * @param string|null $schemaFile
1921 * @return \DOMDocument
22+ *
23+ * @throws \SimpleSAML\XML\Exception\IOException
2024 * @throws \SimpleSAML\XML\Exception\SchemaViolationException
2125 */
22- public static function schemaValidate (DOMDocument $ document ): DOMDocument ;
26+ public static function schemaValidate (DOMDocument $ document, ? string $ schemaFile = null ): DOMDocument ;
2327}
Original file line number Diff line number Diff line change @@ -29,15 +29,22 @@ trait SchemaValidatableElementTrait
2929 /**
3030 * Validate the given DOMDocument against the schema set for this element
3131 *
32+ * @param \DOMDocument $document
33+ * @param string|null $schemaFile
3234 * @return \DOMDocument
35+ *
36+ * @throws \SimpleSAML\XML\Exception\IOException
3337 * @throws \SimpleSAML\XML\Exception\SchemaViolationException
3438 */
35- public static function schemaValidate (DOMDocument $ document ): DOMDocument
39+ public static function schemaValidate (DOMDocument $ document, ? string $ schemaFile = null ): DOMDocument
3640 {
3741 $ internalErrors = libxml_use_internal_errors (true );
3842 libxml_clear_errors ();
3943
40- $ schemaFile = self ::getSchemaFile ();
44+ if ($ schemaFile === null ) {
45+ $ schemaFile = self ::getSchemaFile ();
46+ }
47+
4148 // Must suppress the warnings here in order to throw them as an error below.
4249 $ result = @$ document ->schemaValidate ($ schemaFile );
4350
You can’t perform that action at this time.
0 commit comments