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
53 lines
1.7 KiB
PHP
53 lines
1.7 KiB
PHP
<?php
|
||
|
||
namespace YakNet\AccessibilityConsole\Rules;
|
||
|
||
use DOMElement;
|
||
use YakNet\AccessibilityConsole\Core\Severity;
|
||
use YakNet\AccessibilityConsole\Core\Violation;
|
||
use YakNet\AccessibilityConsole\Core\WCAGStandard;
|
||
|
||
class ImageAltRedundant extends AbstractRule
|
||
{
|
||
public function getId(): string { return 'WCAG_1_1_1_ALT_REDUNDANT'; }
|
||
public function getDescription(): string { return 'Image alt text should not contain redundant words like "image" or "photo".'; }
|
||
public function getStandard(): WCAGStandard { return WCAGStandard::A; }
|
||
public function getSeverity(): Severity { return Severity::WARNING; }
|
||
|
||
/** @var array<int, string> */
|
||
private array $redundantWords = [
|
||
'resmi', 'görüntüsü', 'fotoğrafı', 'grafiği', 'logosu', 'ikonu',
|
||
'image of', 'photo of', 'picture of', 'graphic of', 'logo of', 'icon of'
|
||
];
|
||
|
||
public function check(DOMElement $element): ?Violation
|
||
{
|
||
if (strtolower($element->tagName) !== 'img') {
|
||
return null;
|
||
}
|
||
|
||
if (!$element->hasAttribute('alt')) {
|
||
return null;
|
||
}
|
||
|
||
$alt = trim($element->getAttribute('alt'));
|
||
$cleanAlt = strtolower(preg_replace('/\s+/', ' ', $alt) ?? '');
|
||
|
||
if ($cleanAlt === '') {
|
||
return null;
|
||
}
|
||
|
||
foreach ($this->redundantWords as $word) {
|
||
if (str_starts_with($cleanAlt, $word) || str_contains($cleanAlt, ' ' . $word)) {
|
||
return $this->createViolation(
|
||
$element,
|
||
$this->getDescription(),
|
||
'Remove redundant phrases like "' . $word . '" from the alt text. Screen readers already announce elements as images.'
|
||
);
|
||
}
|
||
}
|
||
|
||
return null;
|
||
}
|
||
}
|