Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
release: v3.2.0 - Enterprise Edition with Live Web Dashboard, PDF/Excel Exporters, Framework Stubs & 110 WCAG Rules
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace YakNet\AccessibilityConsole\Stubs\Laravel;
|
||||
|
||||
use Closure;
|
||||
use YakNet\AccessibilityConsole\Core\Scanner;
|
||||
|
||||
class AccessibilityMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request in Laravel.
|
||||
* Injects a real-time WCAG Accessibility badge into HTML responses when app is in debug mode.
|
||||
*/
|
||||
public function handle(mixed $request, Closure $next): mixed
|
||||
{
|
||||
/** @var \Illuminate\Http\Response $response */
|
||||
$response = $next($request);
|
||||
|
||||
if (!method_exists($response, 'getContent') || !method_exists($response, 'setContent')) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$content = strval($response->getContent());
|
||||
if (!str_contains($content, '</html>')) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$scanner = new Scanner();
|
||||
$result = $scanner->scan($content);
|
||||
$score = intval($result['score'] ?? 0);
|
||||
$badgeColor = $score >= 80 ? '#10b981' : ($score >= 50 ? '#f59e0b' : '#ef4444');
|
||||
|
||||
$badgeHtml = "
|
||||
<div id='yaknet-a11y-badge' style='position:fixed; bottom:16px; right:16px; z-index:999999; font-family:sans-serif; background:#0f172a; color:#fff; padding:8px 16px; border-radius:24px; box-shadow:0 10px 25px rgba(0,0,0,0.3); font-size:12px; display:flex; align-items:center; border:1px solid rgba(255,255,255,0.1); cursor:pointer;' onclick='alert(\"YakNet Accessibility Console Score: {$score}/100\")'>
|
||||
<span style='font-size:16px; margin-right:6px;'>♿</span>
|
||||
<span>A11y Score: <strong style='color:{$badgeColor};'>{$score}/100</strong></span>
|
||||
</div>";
|
||||
|
||||
$response->setContent(str_replace('</body>', $badgeHtml . '</body>', $content));
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace YakNet\AccessibilityConsole\Stubs\Laravel;
|
||||
|
||||
use YakNet\AccessibilityConsole\Core\Scanner;
|
||||
|
||||
trait AssertsAccessibility
|
||||
{
|
||||
/**
|
||||
* Assert that an HTML response or URL passes minimum WCAG accessibility health score.
|
||||
*/
|
||||
public function assertPageIsAccessible(string $htmlOrUrl, int $minScore = 80): void
|
||||
{
|
||||
$scanner = new Scanner();
|
||||
$result = str_starts_with($htmlOrUrl, 'http')
|
||||
? $scanner->scanUrl($htmlOrUrl)
|
||||
: $scanner->scan($htmlOrUrl);
|
||||
|
||||
$score = intval($result['score'] ?? 0);
|
||||
$violations = count($result['violations'] ?? []);
|
||||
|
||||
$message = sprintf('Target failed accessibility audit with score %d/100 (%d violations).', $score, $violations);
|
||||
|
||||
/** @var \PHPUnit\Framework\TestCase $this */
|
||||
$this->assertGreaterThanOrEqual($minScore, $score, $message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user