From 8d8fe434318e0843ea3e63eb97ef99343f49f120 Mon Sep 17 00:00:00 2001 From: Chris Novakovic Date: Sun, 31 Jul 2022 17:20:38 +0100 Subject: [PATCH] Add type declarations, fix function reference --- app/Controllers/RedirectController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Controllers/RedirectController.php b/app/Controllers/RedirectController.php index 17e9ab1..395ed42 100644 --- a/app/Controllers/RedirectController.php +++ b/app/Controllers/RedirectController.php @@ -13,9 +13,9 @@ class RedirectController { $term = trim($_GET['term']); switch ($_GET['type']) { case 'url': - $endpoint = to_endpoint($term); + $endpoint = self::to_endpoint($term); if (!$endpoint) { - ErrorHandler::show('Invalid or unknown TikTok URL format'); + echo 'Invalid or unknown TikTok URL format'; return; } break; @@ -51,7 +51,7 @@ class RedirectController { /** * to_endpoint maps a TikTok URL into a ProxiTok-compatible endpoint URL. */ - static private function to_endpoint($url) { + static private function to_endpoint(string $url): string { if (preg_match('%^https://vm\.tiktok\.com/([A-Za-z0-9]+)%', $url, $m)) { // Short video URL return '/@placeholder/video/' . $m[1];