Fix model name to gemini-1.5-flash v2.2.3

This commit is contained in:
Enes Yakıştır
2026-05-13 12:46:26 +03:00
parent 40dc04d328
commit 3a19c1c534
7 changed files with 149 additions and 9 deletions
+24 -4
View File
@@ -4,10 +4,10 @@ namespace YakNet\AccessibilityConsole\Core;
class RuleEngine
{
/** @var AbstractRule[] */
/** @var array */
private array $rules = [];
public function addRule(AbstractRule $rule): void
public function addRule(mixed $rule): void
{
$this->rules[] = $rule;
}
@@ -19,8 +19,28 @@ class RuleEngine
{
$allViolations = [];
foreach ($this->rules as $rule) {
$violations = $rule->check($doc);
$allViolations = array_merge($allViolations, $violations);
if (method_exists($rule, 'check')) {
// Determine if it's a document-level rule or element-level rule
$reflection = new \ReflectionMethod($rule, 'check');
$params = $reflection->getParameters();
if (isset($params[0]) && $params[0]->getType() && $params[0]->getType()->getName() === 'DOMDocument') {
// Document-level rule (Core\AbstractRule style)
$violations = $rule->check($doc);
$allViolations = array_merge($allViolations, $violations);
} else {
// Element-level rule (Rules\RuleInterface style)
// We need to iterate over all elements
$xpath = new \DOMXPath($doc);
$elements = $xpath->query('//*');
foreach ($elements as $element) {
$violation = $rule->check($element);
if ($violation) {
$allViolations[] = $violation;
}
}
}
}
}
return $allViolations;
}
+5
View File
@@ -11,6 +11,11 @@ class Scanner
}
}
public function addRule(mixed $rule): void
{
$this->engine->addRule($rule);
}
/**
* Scan HTML content for accessibility violations.
*
+1 -1
View File
@@ -2,7 +2,7 @@
namespace YakNet\AccessibilityConsole\Core;
readonly class Violation
class Violation
{
public function __construct(
public string $ruleId,