From 7d680adea7f21030810e323487d114bc9b733dc9 Mon Sep 17 00:00:00 2001 From: Richard Dern Date: Thu, 9 May 2024 16:03:53 +0200 Subject: [PATCH] Added CSS validation --- app/Services/HtmlValidator.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/Services/HtmlValidator.php b/app/Services/HtmlValidator.php index 31bb31f..acfedd7 100644 --- a/app/Services/HtmlValidator.php +++ b/app/Services/HtmlValidator.php @@ -6,11 +6,22 @@ class HtmlValidator { - public static function validateSource(string $html) + public static function validateHtml(string $html) { $response = Http::withHeaders([ 'Content-Type' => 'text/html; charset=utf-8', - ])->withBody($html, 'text/html')->post(env('HTML5_VALIDATOR_URL') . '/?out=json'); + ])->withBody($html, 'text/html')->post(env('HTML_VALIDATOR_URL') . '/?out=json'); + + $json = $response->json(); + + return $json; + } + + public static function validateCss(string $css) + { + $response = Http::withHeaders([ + 'Content-Type' => 'text/css; charset=utf-8', + ])->withBody($css, 'text/css')->post(env('CSS_VALIDATOR_URL') . '/?out=json'); $json = $response->json();