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
58 lines
2.1 KiB
PHP
58 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace YakNet\AccessibilityConsole\Reporting;
|
|
|
|
use YakNet\AccessibilityConsole\Core\Violation;
|
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
|
use Symfony\Component\Console\Command\Command;
|
|
|
|
class XmlFormatter implements FormatterInterface
|
|
{
|
|
public function format(array $violations, int $baselinedCount, SymfonyStyle $io): int
|
|
{
|
|
$dom = new \DOMDocument('1.0', 'utf-8');
|
|
$dom->formatOutput = true;
|
|
|
|
$root = $dom->createElement('report');
|
|
$root->setAttribute('totalViolations', (string)count($violations));
|
|
$root->setAttribute('baselinedViolations', (string)$baselinedCount);
|
|
$dom->appendChild($root);
|
|
|
|
$violationsNode = $dom->createElement('violations');
|
|
$root->appendChild($violationsNode);
|
|
|
|
foreach ($violations as $v) {
|
|
$node = $dom->createElement('violation');
|
|
$node->setAttribute('ruleId', $v->ruleId);
|
|
$node->setAttribute('severity', $v->severity->value);
|
|
$node->setAttribute('standard', $v->standard->value);
|
|
|
|
$msg = $dom->createElement('message', htmlspecialchars($v->message));
|
|
$node->appendChild($msg);
|
|
|
|
$file = $v->location['file'] ?? 'unknown';
|
|
$line = $v->location['line'] ?? 0;
|
|
|
|
$loc = $dom->createElement('location');
|
|
$loc->setAttribute('file', $file);
|
|
$loc->setAttribute('line', (string)$line);
|
|
$node->appendChild($loc);
|
|
|
|
$snippet = $dom->createElement('htmlSnippet');
|
|
$snippet->appendChild($dom->createCDATASection($v->htmlSnippet));
|
|
$node->appendChild($snippet);
|
|
|
|
if ($v->fixSuggestion) {
|
|
$sug = $dom->createElement('suggestion', htmlspecialchars($v->fixSuggestion));
|
|
$node->appendChild($sug);
|
|
}
|
|
|
|
$violationsNode->appendChild($node);
|
|
}
|
|
|
|
$io->write($dom->saveXML() ?: '');
|
|
|
|
return empty($violations) ? Command::SUCCESS : Command::FAILURE;
|
|
}
|
|
}
|