Completed
Push — master ( 64ce22...54527b )
by Richan
01:29
created

CacheableEvent::affectedFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Suitmedia\Cacheable\Events;
4
5
use Illuminate\Queue\SerializesModels;
6
use Suitmedia\Cacheable\Contracts\CacheableModel;
7
8
abstract class CacheableEvent
9
{
10
    use SerializesModels;
11
12
    /**
13
     * The affected fields in the current cacheable event.
14
     *
15
     * @var array
16
     */
17
    protected $affectedFields;
18
19
    /**
20
     * Cacheable model object.
21
     *
22
     * @var \Suitmedia\Cacheable\Contracts\CacheableModel
23
     */
24
    protected $model;
25
26
    /**
27
     * Cache tags which are being invalidating.
28
     *
29
     * @var mixed
30
     */
31
    protected $tags;
32
33
    /**
34
     * Event constructor.
35
     *
36
     * @param \Suitmedia\Cacheable\Contracts\CacheableModel $model
37
     * @param mixed                                         $tags
38
     */
39
    public function __construct(CacheableModel $model, $tags, $affectedFields = [])
40
    {
41
        $this->affectedFields = $affectedFields;
42
        $this->model = $model;
43
        $this->tags = $tags;
44
    }
45
46
    /**
47
     * Affected fields accessor.
48
     *
49
     * @return array
50
     */
51
    public function affectedFields()
52
    {
53
        return $this->affectedFields;
54
    }
55
56
    /**
57
     * Model accessor.
58
     *
59
     * @return \Suitmedia\Cacheable\Contracts\CacheableModel
60
     */
61
    public function model()
62
    {
63
        return $this->model;
64
    }
65
66
    /**
67
     * Tags accessor.
68
     *
69
     * @return mixed
70
     */
71
    public function tags()
72
    {
73
        return $this->tags;
74
    }
75
}
76