Skip to content

Commit

Permalink
refactor: throw RuntimeException if list contains multiple equal entries
Browse files Browse the repository at this point in the history
refs #25
  • Loading branch information
ThorstenSuckow committed Feb 6, 2024
1 parent af225f4 commit b2c50d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Data/ParameterList.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public function toArray(): array
$data = [];

foreach ($this->data as $parameter) {
if (array_key_exists($parameter->getName(), $data)) {
/**
* @see https://github.com/conjoon/php-lib-conjoon/issues/25
*/
throw new RuntimeException("\"" . $parameter->getName() . "\" already in list");
}
$data[$parameter->getName()] = $parameter->getValue();
}

Expand Down

0 comments on commit b2c50d3

Please sign in to comment.