Skip to content

Commit

Permalink
only allow valid params to the manipulator
Browse files Browse the repository at this point in the history
  • Loading branch information
deluxetom committed Dec 20, 2024
1 parent 63099a0 commit 7b8fa08
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Manipulators/BaseManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract class BaseManipulator implements ManipulatorInterface
*/
public function setParams(array $params): static
{
$this->params = $params;
$this->params = array_filter($params, fn (string $key): bool => in_array($key, $this->getApiParams()), ARRAY_FILTER_USE_KEY);

return $this;
}
Expand All @@ -30,8 +30,6 @@ public function setParams(array $params): static
*/
public function getParam(string $name): mixed
{
return array_key_exists($name, $this->params)
? $this->params[$name]
: null;
return $this->params[$name] ?? null;
}
}

0 comments on commit 7b8fa08

Please sign in to comment.