Issues (3627)

bundles/CoreBundle/Entity/FiltersEntityTrait.php (1 issue)

1
<?php
2
3
/*
4
 * @copyright   2016 Mautic Contributors. All rights reserved
5
 * @author      Mautic
6
 *
7
 * @link        http://mautic.org
8
 *
9
 * @license     GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
10
 */
11
12
namespace Mautic\CoreBundle\Entity;
13
14
use Mautic\CoreBundle\Doctrine\Mapping\ClassMetadataBuilder;
15
16
/**
17
 * Trait FiltersEntityTrait.
18
 */
19
trait FiltersEntityTrait
20
{
21
    /**
22
     * @var array
23
     */
24
    private $filters = [];
25
26
    protected static function addFiltersMetadata(ClassMetadataBuilder $builder)
27
    {
28
        $builder->createField('filters', 'array')
29
                ->columnName('filters')
30
                ->nullable()
31
                ->build();
32
    }
33
34
    /**
35
     * @return array
36
     */
37
    public function getFilters()
38
    {
39
        return $this->filters ?: [];
40
    }
41
42
    /**
43
     * @param array $filters
44
     *
45
     * @return $this
46
     */
47
    public function setFilters($filters)
48
    {
49
        $this->isChanged('filters', $filters);
0 ignored issues
show
It seems like isChanged() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
        $this->/** @scrutinizer ignore-call */ 
50
               isChanged('filters', $filters);
Loading history...
50
        $this->filters = $filters;
51
52
        return $this;
53
    }
54
}
55