Files
accessibility-console/src/Core/RuleEngine.php
T

27 lines
569 B
PHP
Raw Normal View History

2026-05-13 09:10:43 +03:00
<?php
namespace YakNet\AccessibilityConsole\Core;
class RuleEngine
{
2026-05-13 12:13:32 +03:00
/** @var AbstractRule[] */
2026-05-13 09:10:43 +03:00
private array $rules = [];
2026-05-13 12:13:32 +03:00
public function addRule(AbstractRule $rule): void
2026-05-13 09:10:43 +03:00
{
$this->rules[] = $rule;
}
/**
2026-05-13 12:13:32 +03:00
* @return Violation[]
2026-05-13 09:10:43 +03:00
*/
2026-05-13 12:13:32 +03:00
public function run(\DOMDocument $doc): array
2026-05-13 09:10:43 +03:00
{
2026-05-13 12:13:32 +03:00
$allViolations = [];
foreach ($this->rules as $rule) {
$violations = $rule->check($doc);
$allViolations = array_merge($allViolations, $violations);
}
return $allViolations;
2026-05-13 09:10:43 +03:00
}
}