Skip to content
Snippets Groups Projects
Commit 9730c4e7 authored by David Maus's avatar David Maus
Browse files

New function: Return true if bag contains a parameter-value-pair

* VuFindSearch/ParamBag.php (contains): New function. Return true if bag contains a parameter-value-pair.
parent 838cb403
No related merge requests found
...@@ -77,6 +77,20 @@ class ParamBag ...@@ -77,6 +77,20 @@ class ParamBag
return isset($this->params[$name]) ? $this->params[$name] : null; return isset($this->params[$name]) ? $this->params[$name] : null;
} }
/**
* Return true if the bag contains a parameter-value-pair.
*
* @param string $name Parameter name
* @param string $value Parameter value
*
* @return boolean
*/
public function contains($name, $value)
{
$haystack = $this->get($name);
return is_array($haystack) && in_array($value, $haystack);
}
/** /**
* Set a parameter. * Set a parameter.
* *
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment