Added parameter nullAllowed to return True if the parameter exists AND the parameter is not null if nullAllowed is set to False, by default it's True.
This commit is contained in:
parent
05f6661a75
commit
ba3b35de9b
1 changed files with 7 additions and 1 deletions
|
@ -68,10 +68,16 @@
|
|||
* Checks if the parameter exists within the RPC request
|
||||
*
|
||||
* @param string $parameter The parameter to check
|
||||
* @param bool $nullAllowed True if the parameter value can be null, False otherwise.
|
||||
* @return bool True if the parameter exists, False otherwise.
|
||||
*/
|
||||
public function containsParameter(string $parameter): bool
|
||||
public function containsParameter(string $parameter, bool $nullAllowed=true): bool
|
||||
{
|
||||
if(!$nullAllowed)
|
||||
{
|
||||
return isset($this->parameters[$parameter]) && $this->parameters[$parameter] !== null;
|
||||
}
|
||||
|
||||
return isset($this->parameters[$parameter]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue