CacheableEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 69
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A affectedFields() 0 4 1
A model() 0 4 1
A tags() 0 4 1
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
     * @param array                                         $affectedFields
39
     */
40
    public function __construct(CacheableModel $model, $tags, $affectedFields = [])
41
    {
42
        $this->affectedFields = $affectedFields;
43
        $this->model = $model;
44
        $this->tags = $tags;
45
    }
46
47
    /**
48
     * Affected fields accessor.
49
     *
50
     * @return array
51
     */
52
    public function affectedFields(): array
53
    {
54
        return $this->affectedFields;
55
    }
56
57
    /**
58
     * Model accessor.
59
     *
60
     * @return \Suitmedia\Cacheable\Contracts\CacheableModel
61
     */
62
    public function model(): CacheableModel
63
    {
64
        return $this->model;
65
    }
66
67
    /**
68
     * Tags accessor.
69
     *
70
     * @return mixed
71
     */
72
    public function tags()
73
    {
74
        return $this->tags;
75
    }
76
}
77