StateChangeEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\SyliusSchedulerPlugin\Event;
6
7
use Setono\SyliusSchedulerPlugin\Model\JobInterface;
8
9
class StateChangeEvent extends JobEvent
10
{
11
    /**
12
     * @var string
13
     */
14
    private $newState;
15
16
    /**
17
     * @param JobInterface $job
18
     * @param string $newState
19
     */
20
    public function __construct(JobInterface $job, string $newState)
21
    {
22
        parent::__construct($job);
23
24
        $this->newState = $newState;
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getNewState(): string
31
    {
32
        return $this->newState;
33
    }
34
35
    /**
36
     * @param string $state
37
     */
38
    public function setNewState(string $state): void
39
    {
40
        $this->newState = $state;
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getOldState(): string
47
    {
48
        return $this->getJob()->getState();
49
    }
50
}
51