PropertyFilterTrait::getPropertyFilter()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Crossjoin\Browscap\PropertyFilter;
5
6
/**
7
 * Trait PropertyFilterTrait
8
 *
9
 * @package Crossjoin\Browscap\PropertyFilter
10
 * @author Christoph Ziegenberg <[email protected]>
11
 * @link https://github.com/crossjoin/browscap
12
 */
13
trait PropertyFilterTrait
14
{
15
    /**
16
     * @var PropertyFilterInterface
17
     */
18
    protected $propertyFilter;
19
20
    /**
21
     * @inheritdoc
22
     */
23
    public function getPropertyFilter() : PropertyFilterInterface
24
    {
25
        if ($this->propertyFilter === null) {
26
            $this->propertyFilter = new None();
27
        }
28
29
        return $this->propertyFilter;
30
    }
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function setPropertyFilter(PropertyFilterInterface $filter)
36
    {
37
        $this->propertyFilter = $filter;
38
    }
39
}
40