-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from Icinga/introduce-base-filter
Introduce trait `ipl\Stdlib\BaseFilter`
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace ipl\Stdlib; | ||
|
||
use ipl\Stdlib\Filter\Rule; | ||
|
||
trait BaseFilter | ||
{ | ||
/** @var Rule Base filter */ | ||
private $baseFilter; | ||
|
||
/** | ||
* Get whether a base filter has been set | ||
* | ||
* @return bool | ||
*/ | ||
public function hasBaseFilter(): bool | ||
{ | ||
return $this->baseFilter !== null; | ||
} | ||
|
||
/** | ||
* Get the base filter | ||
* | ||
* @return ?Rule | ||
*/ | ||
public function getBaseFilter() | ||
{ | ||
return $this->baseFilter; | ||
} | ||
|
||
/** | ||
* Set the base filter | ||
* | ||
* @param Rule $baseFilter | ||
* | ||
* @return $this | ||
*/ | ||
public function setBaseFilter(Rule $baseFilter = null): self | ||
{ | ||
$this->baseFilter = $baseFilter; | ||
|
||
return $this; | ||
} | ||
} |