From 90ca3d64eb02193cd54b494f939da4d1f0033985 Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Tue, 12 Dec 2023 22:57:42 +0200 Subject: [PATCH] fixing small issue --- server/urlManipulator/UrlManipulator.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/server/urlManipulator/UrlManipulator.php b/server/urlManipulator/UrlManipulator.php index 3bdaad5..ccb4eef 100644 --- a/server/urlManipulator/UrlManipulator.php +++ b/server/urlManipulator/UrlManipulator.php @@ -1,5 +1,4 @@ addParamToUrl($url, $newParam, $randomValue); - return ['status' => 200, 'data' => $modifiedUrl]; + return [ + 'before' => $url, + 'after' => $modifiedUrl, + ]; } protected function addParamToUrl(string $url, string $param, string $value): string @@ -54,18 +56,19 @@ class UrlManipulator extends AbstractUrlManipulator return uniqid(); } - protected function getNewParam(array $existingParams): string | null + protected function getNewParam(array $existingParams) { - while (!empty($this->paramsArray)) { - $newParam = array_pop($this->paramsArray); + while (!empty($this->paramsArray)) { + $newParam = array_pop($this->paramsArray); - if (!array_key_exists($newParam, $existingParams)) { - return $newParam; - } - } + if (!array_key_exists($newParam, $existingParams)) { + return $newParam; + } + } - return null; + return null; } + }