webmozarts / assert

Assertions to validate method input/output with nice error messages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: Check that multiple specific keys exist in an array

gordinskiy opened this issue · comments

Whats about adding assertions for multiple array key existence.

Assert::keysExists(array $value, array $keys)
Check if all of provided key are presented in array
May be useful for validation of POST/PUT request where requester must provide entire object.

Assert::oneOfKeysExists(array $value, array $keys)
Check if at least one of provided key are presented in array
May be useful for validation of PATCH request where all fields can be optional but at least one must be provided.