'.github/workflows/accessibility.yml', 'gitlab' => '.gitlab-ci.a11y.yml', 'azure' => 'azure-pipelines.a11y.yml', 'bitbucket' => 'bitbucket-pipelines.a11y.yml', default => throw new \InvalidArgumentException("Unsupported CI platform '{$platform}'."), }; } /** * Generate CI workflow YAML content for the specified platform. */ public function generate( string $platform, string $preset = 'wcag22-aa', int $minScore = 90, string $targetPath = 'resources/views' ): string { return match (strtolower($platform)) { 'github' => $this->generateGitHubActions($preset, $minScore, $targetPath), 'gitlab' => $this->generateGitLabCi($preset, $minScore, $targetPath), 'azure' => $this->generateAzurePipelines($preset, $minScore, $targetPath), 'bitbucket' => $this->generateBitbucketPipelines($preset, $minScore, $targetPath), default => throw new \InvalidArgumentException(sprintf( "Unsupported CI platform '%s'. Supported platforms: %s.", $platform, implode(', ', self::getSupportedPlatforms()) )), }; } private function generateGitHubActions(string $preset, int $minScore, string $targetPath): string { return << gl-a11y-codequality.json - vendor/bin/a11y vpat {$targetPath} --preset={$preset} --format=html --output=vpat-2.5.html artifacts: when: always reports: codequality: gl-a11y-codequality.json paths: - vpat-2.5.html YAML; } private function generateAzurePipelines(string $preset, int $minScore, string $targetPath): string { return <<