-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathSendTask.php
More file actions
92 lines (81 loc) · 2.05 KB
/
SendTask.php
File metadata and controls
92 lines (81 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/*
* Copyright (c) Atsuhiro Kubo <kubo@iteman.jp> and contributors,
* All rights reserved.
*
* This file is part of Workflower.
*
* This program and the accompanying materials are made available under
* the terms of the BSD 2-Clause License which accompanies this
* distribution, and is available at http://opensource.org/licenses/BSD-2-Clause
*/
namespace PHPMentors\Workflower\Workflow\Activity;
use PHPMentors\Workflower\Workflow\Operation\OperationalInterface;
use PHPMentors\Workflower\Workflow\Participant\Role;
use PHPMentors\Workflower\Workflow\Resource\MessageInterface;
/**
* @since 1.3.0
*/
class SendTask extends Task implements MessageInterface, OperationalInterface
{
/**
* @var int|string
*/
private $message;
/**
* @var int|string
*/
private $operation;
/**
* @param int|string $id
* @param Role $role
* @param int|string $operation
* @param string $name
*/
public function __construct($id, Role $role, $message, $operation, $name = null)
{
parent::__construct($id, $role, $name);
$this->message = $message;
$this->operation = $operation;
}
/**
* {@inheritdoc}
*/
public function serialize()
{
return serialize([
get_parent_class($this) => parent::serialize(),
'message' => $this->message,
'operation' => $this->operation,
]);
}
/**
* {@inheritdoc}
*/
public function unserialize($serialized)
{
foreach (unserialize($serialized) as $name => $value) {
if ($name == get_parent_class($this)) {
parent::unserialize($value);
continue;
}
if (property_exists($this, $name)) {
$this->$name = $value;
}
}
}
/**
* {@inheritdoc}
*/
public function getMessage()
{
return $this->message;
}
/**
* {@inheritdoc}
*/
public function getOperation()
{
return $this->operation;
}
}