Completed
Pull Request — master (#31)
by
unknown
01:39
created

StatusUpdated::getModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Spatie\ModelStatus\Events;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * Event fired by the HasStatus trait when a status is updated
9
 *
10
 * @package Spatie\ModelStatus\Events
11
 */
12
class StatusUpdated
13
{
14
    /** @var string */
15
    private $oldStatus;
16
17
    /** @var string */
18
    private $newStatus;
19
20
    /** @var \Illuminate\Database\Eloquent\Model */
21
    private $model;
22
23
    /**
24
     * StatusUpdated constructor.
25
     *
26
     * @param string                              $oldStatus
27
     * @param string                              $newStatus
28
     * @param \Illuminate\Database\Eloquent\Model $model
29
     */
30
    public function __construct(string $oldStatus, string $newStatus, Model $model)
31
    {
32
        $this->oldStatus = $oldStatus;
33
        $this->newStatus = $newStatus;
34
        $this->model = $model;
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getOldStatus(): string
41
    {
42
        return $this->oldStatus;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getNewStatus(): string
49
    {
50
        return $this->newStatus;
51
    }
52
53
    /**
54
     * @return \Illuminate\Database\Eloquent\Model
55
     */
56
    public function getModel(): Model
57
    {
58
        return $this->model;
59
    }
60
}
61