Action::setName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) 2019, Wesley O. Nichols
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Wesnick\WorkflowBundle\Model;
13
14
use ApiPlatform\Core\Annotation\ApiProperty;
15
use Symfony\Component\Serializer\Annotation\Groups;
16
use Symfony\Component\Validator\Constraints as Assert;
17
use Symfony\Component\Validator\ConstraintViolationInterface;
18
use Symfony\Component\Validator\ConstraintViolationList;
19
use Symfony\Component\Validator\ConstraintViolationListInterface;
20
21
/**
22
 * An action performed by a direct agent and indirect participants upon a direct object. Optionally happens at a location with the help of an inanimate instrument. The execution of the action may produce a result. Specific action sub-type documentation specifies the exact expectation of each argument/role.\\n\\nSee also \[blog post\](http://blog.schema.org/2014/04/announcing-schemaorg-actions.html) and \[Actions overview document\](http://schema.org/docs/actions.html).
23
 *
24
 * @see http://schema.org/Action Documentation on Schema.org
25
 *
26
 * @author Wesley O. Nichols <[email protected]>
27
 */
28
class Action
29
{
30
    /**
31
     * @var string|null indicates the current disposition of the Action
32
     *
33
     * @ApiProperty(iri="http://schema.org/actionStatus")
34
     * @Groups({"workflowAction:output"})
35
     * @Assert\Type(type="string")
36
     * @Assert\Choice(choices={
37
     *     "PotentialActionStatus",
38
     *     "ActiveActionStatus",
39
     *     "FailedActionStatus",
40
     *     "CompletedActionStatus"
41
     * })
42
     */
43
    private $actionStatus = 'PotentialActionStatus';
44
45
    /**
46
     * @var EntryPoint|null indicates a target EntryPoint for an Action
47
     *
48
     * @ApiProperty(iri="http://schema.org/target")
49
     * @Groups({"workflowAction:output"})
50
     */
51
    private $target;
52
53
    /**
54
     * @var string|null the name of the item
55
     *
56
     * @ApiProperty(iri="http://schema.org/name")
57
     * @Groups({"workflowAction:output"})
58
     * @Assert\Type(type="string")
59
     */
60
    private $name;
61
62
    /**
63
     * @var string|null a description of the item
64
     *
65
     * @ApiProperty(iri="http://schema.org/description")
66
     * @Groups({"workflowAction:output"})
67
     * @Assert\Type(type="string")
68
     */
69
    private $description;
70
71
    /**
72
     * @var ConstraintViolationListInterface|null
73
     *
74
     * @ApiProperty(iri="http://schema.org/error")
75
     * @Groups({"workflowAction:output"})
76
     *
77
     * @var ConstraintViolationList
78
     */
79
    private $error;
80
81
    public function setActionStatus(?string $actionStatus): void
82
    {
83
        $this->actionStatus = $actionStatus;
84
    }
85
86
    public function getActionStatus(): ?string
87
    {
88
        return $this->actionStatus;
89
    }
90
91
    /**
92
     * @return EntryPoint|null
93
     */
94
    public function getTarget(): ?EntryPoint
95
    {
96
        return $this->target;
97
    }
98
99
    /**
100
     * @param EntryPoint $target
101
     */
102
    public function setTarget(EntryPoint $target): void
103
    {
104
        $this->target = $target;
105
    }
106
107
    /**
108
     * @return string|null
109
     */
110
    public function getName(): ?string
111
    {
112
        return $this->name;
113
    }
114
115
    /**
116
     * @param string|null $name
117
     */
118
    public function setName(?string $name): void
119
    {
120
        $this->name = $name;
121
    }
122
123
    /**
124
     * @return string|null
125
     */
126
    public function getDescription(): ?string
127
    {
128
        return $this->description;
129
    }
130
131
    /**
132
     * @param string|null $description
133
     */
134
    public function setDescription(?string $description): void
135
    {
136
        $this->description = $description;
137
    }
138
139
    /**
140
     * @return ConstraintViolationListInterface|null
141
     */
142
    public function getError(): ?ConstraintViolationListInterface
143
    {
144
        return $this->error;
145
    }
146
147
    /**
148
     * @param ConstraintViolationInterface $error
149
     */
150
    public function addError(ConstraintViolationInterface $error): void
151
    {
152
        if (null === $this->error) {
153
            $this->error = new ConstraintViolationList();
154
        }
155
156
        $this->error->add($error);
157
    }
158
}
159