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

Add tagging support to backend exceptions

* VuFindSearch/Backend/Exception/BackendException.php ($tags): New
  property. Tags.
  (addTag, getTags, hasTag): New functions. Tagging support.
parent e487ec6b
No related merge requests found
...@@ -42,4 +42,44 @@ use VuFindSearch\Exception\RuntimeException; ...@@ -42,4 +42,44 @@ use VuFindSearch\Exception\RuntimeException;
*/ */
class BackendException extends RuntimeException class BackendException extends RuntimeException
{ {
/**
* Tags.
*
* @var array
*/
protected $tags = array();
/**
* Add a tag.
*
* @param string $tag Tag name
*
* @return void
*/
public function addTag($tag)
{
$this->tags[] = (string)$tag;
}
/**
* Return all tags.
*
* @return array
*/
public function getTags()
{
return $this->tags;
}
/**
* Return true if the exception has the requested tag.
*
* @param string $tag Tag
*
* @return boolean
*/
public function hasTag($tag)
{
return in_array($tag, $this->tags);
}
} }
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