fixing small issue

This commit is contained in:
Kfir Dayan 2023-12-12 22:57:42 +02:00
parent 583e45b31c
commit 90ca3d64eb

View file

@ -1,5 +1,4 @@
<?php <?php
namespace urlManipulator; namespace urlManipulator;
class UrlManipulator extends AbstractUrlManipulator class UrlManipulator extends AbstractUrlManipulator
@ -33,7 +32,10 @@ class UrlManipulator extends AbstractUrlManipulator
$modifiedUrl = $this->addParamToUrl($url, $newParam, $randomValue); $modifiedUrl = $this->addParamToUrl($url, $newParam, $randomValue);
return ['status' => 200, 'data' => $modifiedUrl]; return [
'before' => $url,
'after' => $modifiedUrl,
];
} }
protected function addParamToUrl(string $url, string $param, string $value): string protected function addParamToUrl(string $url, string $param, string $value): string
@ -54,7 +56,7 @@ class UrlManipulator extends AbstractUrlManipulator
return uniqid(); return uniqid();
} }
protected function getNewParam(array $existingParams): string | null protected function getNewParam(array $existingParams)
{ {
while (!empty($this->paramsArray)) { while (!empty($this->paramsArray)) {
$newParam = array_pop($this->paramsArray); $newParam = array_pop($this->paramsArray);
@ -67,5 +69,6 @@ class UrlManipulator extends AbstractUrlManipulator
return null; return null;
} }
} }