| 1 | <?php |
||
| 15 | class Filter |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var null|AbstractCommon |
||
| 19 | */ |
||
| 20 | private static $analyzer = null; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var array |
||
| 24 | */ |
||
| 25 | private static $filters = []; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Filter constructor. |
||
| 29 | * |
||
| 30 | * @param CaseInsensitive $caseInsensitive |
||
| 31 | */ |
||
| 32 | 29 | public function __construct(CaseInsensitive $caseInsensitive) |
|
| 36 | |||
| 37 | /** |
||
| 38 | * @param AbstractCommon $analyzer |
||
| 39 | */ |
||
| 40 | 1 | public static function setAnalyzer(AbstractCommon $analyzer) |
|
| 44 | |||
| 45 | /** |
||
| 46 | * @return null|AbstractCommon|CaseInsensitive |
||
| 47 | */ |
||
| 48 | 2 | public static function getAnalyzer() |
|
| 52 | |||
| 53 | /** |
||
| 54 | * @param string $filter |
||
| 55 | * @param mixed $option |
||
| 56 | */ |
||
| 57 | 1 | public static function addFilter($filter, $option) |
|
| 69 | |||
| 70 | /** |
||
| 71 | * @return void |
||
| 72 | */ |
||
| 73 | 2 | public function setFilters() |
|
| 77 | } |
||
| 78 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: