diff --git a/Classes/Validation/AbstactDomDocumentValidator.php b/Classes/Validation/AbstactDomDocumentValidator.php index c073d390..1054e946 100644 --- a/Classes/Validation/AbstactDomDocumentValidator.php +++ b/Classes/Validation/AbstactDomDocumentValidator.php @@ -34,6 +34,7 @@ abstract class AbstactDomDocumentValidator extends AbstractDlfValidator { + protected DOMXpath $xpath; public function __construct() @@ -57,6 +58,5 @@ protected function createNodeValidator(?DOMNode $node): DomNodeValidator return new DomNodeValidator($this->xpath, $this->result, $node); } - protected abstract function isValidDocument(); - + abstract function isValidDocument(); } diff --git a/Classes/Validation/ApplicationProfileValidationStack.php b/Classes/Validation/ApplicationProfileValidationStack.php index ec30b998..9ab3c46a 100644 --- a/Classes/Validation/ApplicationProfileValidationStack.php +++ b/Classes/Validation/ApplicationProfileValidationStack.php @@ -35,7 +35,8 @@ use Slub\Dfgviewer\Validation\Mets\LogicalStructureValidator; use Slub\Dfgviewer\Validation\Mets\PhysicalStructureValidator; -class ApplicationProfileValidationStack extends AbstractDlfValidationStack { +class ApplicationProfileValidationStack extends AbstractDlfValidationStack +{ public function __construct() { parent::__construct(\DOMDocument::class); diff --git a/Classes/Validation/Dom/DomNodeListValidator.php b/Classes/Validation/Dom/DomNodeListValidator.php index 4edc6414..cb6fb1d1 100644 --- a/Classes/Validation/Dom/DomNodeListValidator.php +++ b/Classes/Validation/Dom/DomNodeListValidator.php @@ -41,6 +41,7 @@ */ class DomNodeListValidator { + private string $expression; private ?DOMNode $contextNode; @@ -130,7 +131,7 @@ public function validateHasNoneOrOne(): DomNodeListValidator private function addError(string $prefix): void { $message = $prefix . ' that matches the XPath expression "' . $this->expression . '"'; - if($this->contextNode) { + if ($this->contextNode) { $message .= ' under "' . $this->contextNode->getNodePath() . '"'; } $this->result->addError(new Error($message, 23)); diff --git a/Classes/Validation/Dom/DomNodeValidator.php b/Classes/Validation/Dom/DomNodeValidator.php index a3fda971..392da9fe 100644 --- a/Classes/Validation/Dom/DomNodeValidator.php +++ b/Classes/Validation/Dom/DomNodeValidator.php @@ -40,6 +40,7 @@ */ class DomNodeValidator { + protected DOMXPath $xpath; /** diff --git a/Classes/Validation/Mets/AdministrativeMetadataValidator.php b/Classes/Validation/Mets/AdministrativeMetadataValidator.php index 7c5944be..8626265c 100644 --- a/Classes/Validation/Mets/AdministrativeMetadataValidator.php +++ b/Classes/Validation/Mets/AdministrativeMetadataValidator.php @@ -89,8 +89,8 @@ protected function validateDigitalProvenanceMetadataNode(\DOMNode $digitalProven ->getFirstNode(); $this->createNodeValidator($mdWrap) - ->validateHasAttributeWithValue('MDTYPE', array('OTHER')) - ->validateHasAttributeWithValue('OTHERMDTYPE', array('DVLINKS')); + ->validateHasAttributeWithValue('MDTYPE', ['OTHER']) + ->validateHasAttributeWithValue('OTHERMDTYPE', ['DVLINKS']); $this->createNodeListValidator('mets:xmlData[dv:links]', $mdWrap) ->validateHasOne(); diff --git a/Classes/Validation/Mets/DigitalRepresentationValidator.php b/Classes/Validation/Mets/DigitalRepresentationValidator.php index 2995b312..d8a51934 100644 --- a/Classes/Validation/Mets/DigitalRepresentationValidator.php +++ b/Classes/Validation/Mets/DigitalRepresentationValidator.php @@ -45,7 +45,7 @@ public function isValidDocument(): void ->validateHasNoneOrOne(); // If a physical structure is present, there must be one file section. - if($this->xpath->query(VH::XPATH_PHYSICAL_STRUCTURES)->length > 0){ + if ($this->xpath->query(VH::XPATH_PHYSICAL_STRUCTURES)->length > 0) { $this->createNodeListValidator(VH::XPATH_FILE_SECTIONS) ->validateHasOne(); } @@ -110,7 +110,7 @@ protected function validateFile(\DOMNode $file): void ->getFirstNode(); $this->createNodeValidator($fLocat) - ->validateHasAttributeWithValue('LOCTYPE', array('URL', 'PURL')) + ->validateHasAttributeWithValue('LOCTYPE', ['URL', 'PURL']) ->validateHasAttributeWithUrl('xlink:href'); } }