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
61 lines
2.0 KiB
PHP
61 lines
2.0 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace YakNet\AccessibilityConsole\Notifications;
|
||
|
|
|
||
|
|
use GuzzleHttp\Client;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Sends accessibility scan summaries to Microsoft Teams channels via Incoming Webhook.
|
||
|
|
*/
|
||
|
|
class MicrosoftTeamsNotifier implements NotifierInterface
|
||
|
|
{
|
||
|
|
private Client $httpClient;
|
||
|
|
|
||
|
|
public function __construct(
|
||
|
|
private string $webhookUrl,
|
||
|
|
?Client $httpClient = null
|
||
|
|
) {
|
||
|
|
$this->httpClient = $httpClient ?? new Client(['timeout' => 5.0]);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function send(NotificationPayload $payload): bool
|
||
|
|
{
|
||
|
|
if ($this->webhookUrl === '') {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
$themeColor = $payload->healthScore >= 90 ? '10B981' : ($payload->healthScore >= 70 ? 'F59E0B' : 'EF4444');
|
||
|
|
$status = $payload->healthScore >= 90 ? 'PASSED' : 'NEEDS ATTENTION';
|
||
|
|
|
||
|
|
$body = [
|
||
|
|
'@type' => 'MessageCard',
|
||
|
|
'@context' => 'https://schema.org/extensions',
|
||
|
|
'themeColor' => $themeColor,
|
||
|
|
'summary' => "Accessibility Audit: {$payload->target} ({$payload->healthScore}/100)",
|
||
|
|
'sections' => [
|
||
|
|
[
|
||
|
|
'activityTitle' => "♿ YakNet Accessibility Console — {$payload->target}",
|
||
|
|
'activitySubtitle' => "Status: {$status}",
|
||
|
|
'facts' => [
|
||
|
|
['name' => 'Health Score', 'value' => "{$payload->healthScore}/100"],
|
||
|
|
['name' => 'Total Violations', 'value' => (string)$payload->totalViolations],
|
||
|
|
['name' => 'Errors / Critical', 'value' => (string)$payload->errorCount],
|
||
|
|
['name' => 'Warnings', 'value' => (string)$payload->warningCount],
|
||
|
|
],
|
||
|
|
'markdown' => true,
|
||
|
|
],
|
||
|
|
],
|
||
|
|
];
|
||
|
|
|
||
|
|
try {
|
||
|
|
$response = $this->httpClient->post($this->webhookUrl, [
|
||
|
|
'json' => $body,
|
||
|
|
]);
|
||
|
|
return $response->getStatusCode() < 300;
|
||
|
|
} catch (\Throwable) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|