-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaction.php
152 lines (141 loc) · 3.91 KB
/
action.php
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
/**
* @author Chris Zuber <chris@chriszuber.com>
* @package superuserdev/schemaserver
* @copyright 2017
* @license https://opensource.org/licenses/LGPL-3.0 GNU Lesser General Public License version 3
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
namespace SuperUserDev\SchemaServer;
/**
* @see https://schema.org/Action
*/
use \InvalidArgumentException;
class Action extends Thing
{
use Traits\DateTime;
/**
* [setActionStatus description]
* @param ActionStatusType $status [description]
*/
final public function setActionStatus(ActionStatusType $status): self
{
return $this->_set('actionStatus', $status);
}
/**
* [setAgent description]
* @param Thing $agent [description]
*/
final public function setAgent(Thing $agent): self
{
if ($agent instanceof Person or $agent instanceof Organization) {
return $this->_set('agent', $agent);
} else {
throw new InvalidArgumentException(sprintf(
'Author must be an instance of Person or Organization. Instance of %s given',
$agent::getType()
));
}
}
/**
* [setEndDate description]
* @param String $date [description]
* @param boolean $use_date [description]
* @param boolean $use_time [description]
*/
final public function setEndDate(
String $date,
Bool $use_date = true,
Bool $use_time = true
): self
{
return $this->_set('endDate', static::formatDateTime($date, $use_date, $use_time));
}
/**
* [setError description]
* @param Thing $error [description]
*/
final public function setError(Thing $error): self
{
return $this->_set('error', $error);
}
/**
* [setLocation description]
* @param Thing $location [description]
*/
final public function setLocation(Thing $location): self
{
if ($location instanceof PostalAddress or $location instanceof Place) {
return $this->_set('location', $location);
} else {
throw new InvalidArgumentException(sprintf(
'Location must be an instance of PostalAddress or Place. Instance of %s given.',
$location::getType()
));
}
}
/**
* [setObject description]
* @param Thing $object [description]
*/
final public function setObject(Thing $object): self
{
return $this->_set('object', $object);
}
/**
* [setParticipant description]
* @param Thing $participant [description]
*/
final public function setParticipant(Thing $participant)
{
if ($participant instanceof Person or $participant instanceof Organization) {
return $this->_set('participant', $participant);
} else {
throw new InvalidArgumentException(sprintf(
'Participant must be an instance of Person or Organization. Instance of %s given.',
$participant::getType()
));
}
}
/**
* [setResult description]
* @param Thing $result [description]
*/
final public function setResult(Thing $result)
{
return $this->_set('result', $result);
}
/**
* [setStartDate description]
* @param String $date [description]
* @param boolean $use_date [description]
* @param boolean $use_time [description]
*/
final public function setStartDate(
String $date,
Bool $use_date = true,
Bool $use_time = true
)
{
return $this->_set('startDate', static::formatDateTime($date, $use_date, $use_time));
}
/**
* [setTarget description]
* @param EntryPoint $target [description]
*/
final public function setTarget(EntryPoint $target)
{
return $this->_set('target', $target);
}
}