Skip to content

Commit

Permalink
fix comparison by different casing
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasVHG committed Aug 1, 2024
1 parent db0a8ad commit 6243d9a
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace CultuurNet\UDB3\Http\Offer;

use _HumbugBox113887eee2b6\___PHPSTORM_HELPERS\this;
use CultuurNet\UDB3\Http\ApiProblem\ApiProblem;
use CultuurNet\UDB3\Http\ApiProblem\SchemaError;
use CultuurNet\UDB3\Http\Request\Body\RequestBodyParser;
Expand Down Expand Up @@ -42,6 +43,8 @@ private function getSchemaErrors(array $priceInfos): array
$errors = [];
$nameMatrix = [];

$priceInfos = $this->trimArrayValues($priceInfos);

foreach ($priceInfos as $index => $priceInfo) {
foreach ($priceInfo['name'] as $language => $name) {
if (isset($nameMatrix[$language]) && in_array($name, $nameMatrix[$language], true)) {
Expand All @@ -56,4 +59,16 @@ private function getSchemaErrors(array $priceInfos): array

return $errors;
}

private function trimArrayValues(array $array): array
{
foreach ($array as $key => $value) {
if (is_array($value)) {
$array[$key] = $this->trimArrayValues($value);
} else {
$array[$key] = is_string($value) ? trim($value) : $value;
}
}
return $array;
}
}

0 comments on commit 6243d9a

Please sign in to comment.