1 | <?php |
||
19 | final class SubStatement extends Object |
||
20 | { |
||
21 | /** |
||
22 | * @var Verb $verb The {@link Verb} |
||
23 | */ |
||
24 | private $verb; |
||
25 | |||
26 | /** |
||
27 | * @var Actor The {@link Actor} |
||
28 | */ |
||
29 | private $actor; |
||
30 | |||
31 | /** |
||
32 | * @var Object The {@link Object} |
||
33 | */ |
||
34 | private $object; |
||
35 | |||
36 | /** |
||
37 | * @var Result The {@link Activity} {@link Result} |
||
38 | */ |
||
39 | private $result; |
||
40 | |||
41 | /** |
||
42 | * @var Context The {@link Statement} {@link Context} |
||
43 | */ |
||
44 | private $context; |
||
45 | |||
46 | public function __construct(Actor $actor, Verb $verb, Object $object, Result $result = null, Context $context = null) |
||
47 | { |
||
48 | $this->actor = $actor; |
||
49 | $this->verb = $verb; |
||
50 | $this->object = $object; |
||
51 | $this->result = $result; |
||
52 | $this->context = $context; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Returns the Statement's {@link Verb}. |
||
57 | * |
||
58 | * @return Verb The Verb |
||
59 | */ |
||
60 | public function getVerb() |
||
61 | { |
||
62 | return $this->verb; |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Returns the Statement's {@link Actor}. |
||
67 | * |
||
68 | * @return Actor The Actor |
||
69 | */ |
||
70 | public function getActor() |
||
71 | { |
||
72 | return $this->actor; |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * Returns the Statement's {@link Object}. |
||
77 | * |
||
78 | * @return \Xabbuh\XApi\Model\Object The Object |
||
79 | */ |
||
80 | public function getObject() |
||
81 | { |
||
82 | return $this->object; |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * Returns the {@link Activity} {@link Result}. |
||
87 | * |
||
88 | * @return Result The Result |
||
89 | */ |
||
90 | public function getResult() |
||
91 | { |
||
92 | return $this->result; |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * Returns the {@link Statement} {@link Context}. |
||
97 | * |
||
98 | * @return Context The Context |
||
99 | */ |
||
100 | public function getContext() |
||
101 | { |
||
102 | return $this->context; |
||
103 | } |
||
104 | |||
105 | /** |
||
106 | * Tests whether or not this Statement is a void Statement (i.e. it voids |
||
107 | * another Statement). |
||
108 | * |
||
109 | * @return bool True if the Statement voids another Statement, false otherwise |
||
110 | */ |
||
111 | public function isVoidStatement() |
||
115 | |||
116 | /** |
||
117 | * Returns a {@link StatementReference} for the Statement. |
||
118 | * |
||
119 | * @return StatementReference The reference |
||
120 | */ |
||
121 | public function getStatementReference() |
||
127 | |||
128 | /** |
||
129 | * Returns a Statement that voids the current Statement. |
||
130 | * |
||
131 | * @param Actor $actor The Actor voiding this Statement |
||
132 | * |
||
133 | * @return Statement The voiding Statement |
||
134 | */ |
||
135 | public function getVoidStatement(Actor $actor) |
||
144 | |||
145 | /** |
||
146 | * {@inheritdoc} |
||
147 | */ |
||
148 | public function equals(Object $statement) |
||
149 | { |
||
150 | if ('Xabbuh\XApi\Model\SubStatement' !== get_class($statement)) { |
||
190 | } |
||
191 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: