|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Veslo project <https://github.com/symfony-doge/veslo>. |
|
5
|
|
|
* |
|
6
|
|
|
* (C) 2019 Pavel Petrov <[email protected]>. |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
* |
|
11
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 GPL-3.0 |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
declare(strict_types=1); |
|
15
|
|
|
|
|
16
|
|
|
namespace Veslo\AnthillBundle\Event\Vacancy\Decision; |
|
17
|
|
|
|
|
18
|
|
|
use Symfony\Component\EventDispatcher\Event; |
|
19
|
|
|
use Veslo\AnthillBundle\Vacancy\DecisionInterface; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Describes context of the applied decision for subscribers that can perform some side actions |
|
23
|
|
|
*/ |
|
24
|
|
|
class AppliedEvent extends Event |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* Event name |
|
28
|
|
|
* |
|
29
|
|
|
* @const string |
|
30
|
|
|
*/ |
|
31
|
|
|
public const NAME = 'veslo.anthill.event.vacancy.decision.applied'; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* The decision |
|
35
|
|
|
* |
|
36
|
|
|
* @var DecisionInterface |
|
37
|
|
|
*/ |
|
38
|
|
|
private $decision; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Decision context |
|
42
|
|
|
* |
|
43
|
|
|
* @var object |
|
44
|
|
|
*/ |
|
45
|
|
|
private $context; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Evaluation result |
|
49
|
|
|
* |
|
50
|
|
|
* @var bool |
|
51
|
|
|
*/ |
|
52
|
|
|
private $isApplied; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* AppliedEvent constructor. |
|
56
|
|
|
* |
|
57
|
|
|
* @param DecisionInterface $decision The decision |
|
58
|
|
|
* @param object $context Decision context |
|
59
|
|
|
* @param bool $isApplied Evaluation result |
|
60
|
|
|
*/ |
|
61
|
|
|
public function __construct(DecisionInterface $decision, object $context, bool $isApplied) |
|
62
|
|
|
{ |
|
63
|
|
|
$this->decision = $decision; |
|
64
|
|
|
$this->context = $context; |
|
65
|
|
|
$this->isApplied = $isApplied; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Returns an applied decision |
|
70
|
|
|
* |
|
71
|
|
|
* @return DecisionInterface |
|
72
|
|
|
*/ |
|
73
|
|
|
public function getDecision(): DecisionInterface |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->decision; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Returns a decision context |
|
80
|
|
|
* |
|
81
|
|
|
* @return object |
|
82
|
|
|
*/ |
|
83
|
|
|
public function getContext(): object |
|
84
|
|
|
{ |
|
85
|
|
|
return $this->context; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Returns the evaluation result |
|
90
|
|
|
* |
|
91
|
|
|
* @return bool |
|
92
|
|
|
*/ |
|
93
|
|
|
public function isApplied(): bool |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->isApplied; |
|
96
|
|
|
} |
|
97
|
|
|
} |
|
98
|
|
|
|