-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathServiceTask.php
More file actions
76 lines (67 loc) · 1.72 KB
/
ServiceTask.php
File metadata and controls
76 lines (67 loc) · 1.72 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
<?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;
/**
* @since 1.2.0
*/
class ServiceTask extends Task implements OperationalInterface
{
/**
* @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, $operation, $name = null)
{
parent::__construct($id, $role, $name);
$this->operation = $operation;
}
/**
* {@inheritdoc}
*/
public function serialize()
{
return serialize([
get_parent_class($this) => parent::serialize(),
'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 getOperation()
{
return $this->operation;
}
}