|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* This file is part of the Backup package, an RunOpenCode project. |
|
4
|
|
|
* |
|
5
|
|
|
* (c) 2015 RunOpenCode |
|
6
|
|
|
* |
|
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
8
|
|
|
* file that was distributed with this source code. |
|
9
|
|
|
* |
|
10
|
|
|
* This project is fork of "kbond/php-backup", for full credits info, please |
|
11
|
|
|
* view CREDITS file that was distributed with this source code. |
|
12
|
|
|
*/ |
|
13
|
|
|
namespace RunOpenCode\Backup\Event; |
|
14
|
|
|
|
|
15
|
|
|
use RunOpenCode\Backup\Contract\BackupInterface; |
|
16
|
|
|
use RunOpenCode\Backup\Contract\ProfileInterface; |
|
17
|
|
|
use RunOpenCode\Backup\Contract\WorkflowActivityInterface; |
|
18
|
|
|
use Symfony\Component\EventDispatcher\GenericEvent; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Class BackupEvent |
|
22
|
|
|
* |
|
23
|
|
|
* Backup event is event instance that is dispatched throughout backup library. |
|
24
|
|
|
* |
|
25
|
|
|
* @package RunOpenCode\Backup\Event |
|
26
|
|
|
*/ |
|
27
|
|
|
final class BackupEvent extends GenericEvent |
|
28
|
|
|
{ |
|
29
|
26 |
|
public function __construct($subject = null, ProfileInterface $profile = null, BackupInterface $backup = null, WorkflowActivityInterface $activity = null) |
|
30
|
|
|
{ |
|
31
|
26 |
|
parent::__construct($subject, array( |
|
32
|
26 |
|
'profile' => $profile, |
|
33
|
26 |
|
'backup' => $backup, |
|
34
|
13 |
|
'activity' => $activity |
|
35
|
13 |
|
)); |
|
36
|
26 |
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Get activity which dispatched the event. |
|
40
|
|
|
* |
|
41
|
|
|
* @return WorkflowActivityInterface|null |
|
42
|
|
|
*/ |
|
43
|
|
|
public function getActivity() |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->getArgument('activity'); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Get current processing profile. |
|
50
|
|
|
* |
|
51
|
|
|
* @return ProfileInterface|null |
|
52
|
|
|
*/ |
|
53
|
2 |
|
public function getProfile() |
|
54
|
|
|
{ |
|
55
|
2 |
|
return $this->getArgument('profile'); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Get current processing backup. |
|
60
|
|
|
* |
|
61
|
|
|
* @return BackupInterface|null |
|
62
|
|
|
*/ |
|
63
|
14 |
|
public function getBackup() |
|
64
|
|
|
{ |
|
65
|
14 |
|
return $this->getArgument('backup'); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|