Proje dosyaları eklendi

This commit is contained in:
2026-08-29 15:53:53 +03:00
commit d3313400ca
440 changed files with 24827 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Serp\Data;
use InvalidArgumentException;
final readonly class SerpResultData
{
public function __construct(public int $position, public string $url, public ?string $title = null, public ?string $displayUrl = null, public ?string $snippet = null, public string $resultType = 'organic')
{
if ($position < 1) {
throw new InvalidArgumentException('Position pozitif olmalıdır.');
}
if ($resultType !== 'organic') {
throw new InvalidArgumentException('Desteklenmeyen sonuç türü.');
}
if (strlen($url) > 2048 || ! filter_var($url, FILTER_VALIDATE_URL) || ! in_array(strtolower((string) parse_url($url, PHP_URL_SCHEME)), ['http', 'https'], true)) {
throw new InvalidArgumentException('Geçersiz sonuç URL adresi.');
}
if (($title !== null && mb_strlen($title) > 500) || ($displayUrl !== null && mb_strlen($displayUrl) > 500) || ($snippet !== null && mb_strlen($snippet) > 5000)) {
throw new InvalidArgumentException('Sonuç alanı izin verilen uzunluğu aşıyor.');
}
}
}