Skip to content

Commit

Permalink
Fix codacy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
markusweigelt committed Jan 9, 2025
1 parent 45230a9 commit 4f8c4ef
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Classes/Validation/AbstactDomDocumentValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

abstract class AbstactDomDocumentValidator extends AbstractDlfValidator
{

protected DOMXpath $xpath;

public function __construct()
Expand All @@ -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();
}
3 changes: 2 additions & 1 deletion Classes/Validation/ApplicationProfileValidationStack.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion Classes/Validation/Dom/DomNodeListValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
*/
class DomNodeListValidator
{

private string $expression;

private ?DOMNode $contextNode;
Expand Down Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions Classes/Validation/Dom/DomNodeValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
*/
class DomNodeValidator
{

protected DOMXPath $xpath;

/**
Expand Down
4 changes: 2 additions & 2 deletions Classes/Validation/Mets/AdministrativeMetadataValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions Classes/Validation/Mets/DigitalRepresentationValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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');
}
}

0 comments on commit 4f8c4ef

Please sign in to comment.