1 | <?php |
||
36 | class ResultDescriptor extends AbstractNameAwareDescriptor implements ResultDescriptorInterface |
||
37 | { |
||
38 | |||
39 | /** |
||
40 | * The action result type. |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $type; |
||
45 | |||
46 | /** |
||
47 | * The action result value. |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $result; |
||
52 | |||
53 | /** |
||
54 | * The HTTP response code that has to be send. |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $code = 200; |
||
59 | |||
60 | /** |
||
61 | * Sets the action result type. |
||
62 | * |
||
63 | * @param string $type The action result type |
||
64 | * |
||
65 | * @return void |
||
66 | */ |
||
67 | public function setType($type) |
||
71 | |||
72 | /** |
||
73 | * Returns the action result type. |
||
74 | * |
||
75 | * @return string The action result type |
||
76 | */ |
||
77 | public function getType() |
||
81 | |||
82 | /** |
||
83 | * Sets the action result value. |
||
84 | * |
||
85 | * @param string $result The action result value |
||
86 | * |
||
87 | * @return void |
||
88 | */ |
||
89 | public function setResult($result) |
||
93 | |||
94 | /** |
||
95 | * Returns the action result value. |
||
96 | * |
||
97 | * @return string The action result value |
||
98 | */ |
||
99 | public function getResult() |
||
103 | |||
104 | /** |
||
105 | * Sets the HTTP response code that has to be send. |
||
106 | * |
||
107 | * @param integer $code The HTTP response code |
||
108 | * |
||
109 | * @return void |
||
110 | */ |
||
111 | public function setCode($code) |
||
115 | |||
116 | /** |
||
117 | * Returns the HTTP response code that has to be send. |
||
118 | * |
||
119 | * @return integer The HTTP response code |
||
120 | */ |
||
121 | public function getCode() |
||
125 | |||
126 | /** |
||
127 | * Returns a new descriptor instance. |
||
128 | * |
||
129 | * @return \AppserverIo\Routlt\Description\ResultDescriptorInterface The descriptor instance |
||
130 | */ |
||
131 | public static function newDescriptorInstance() |
||
135 | |||
136 | /** |
||
137 | * Initializes the result configuration instance from the passed reflection annotation instance. |
||
138 | * |
||
139 | * @param \AppserverIo\Lang\Reflection\AnnotationInterface $reflectionAnnotation The reflection annotation with the result configuration |
||
140 | * |
||
141 | * @return \AppserverIo\Routlt\Description\ResultDescriptorInterface The initialized descriptor |
||
142 | */ |
||
143 | public function fromReflectionAnnotation(AnnotationInterface $reflectionAnnotation) |
||
165 | |||
166 | /** |
||
167 | * Initializes a action configuration instance from the passed deployment descriptor node. |
||
168 | * |
||
169 | * @param \SimpleXmlElement $node The deployment node with the action configuration |
||
170 | * |
||
171 | * @return \AppserverIo\Routlt\Description\ActionDescriptorInterface The initialized descriptor |
||
172 | */ |
||
173 | public function fromDeploymentDescriptor(\SimpleXmlElement $node) |
||
176 | |||
177 | /** |
||
178 | * Initializes a action configuration instance from the passed configuration node. |
||
179 | * |
||
180 | * @param \AppserverIo\Configuration\Interfaces\NodeInterface $node The configuration node with the action configuration |
||
181 | * |
||
182 | * @return \AppserverIo\Routlt\Description\ActionDescriptorInterface The initialized descriptor |
||
183 | */ |
||
184 | public function fromConfiguration(NodeInterface $node) |
||
187 | |||
188 | /** |
||
189 | * Merges the passed configuration into this one. Configuration values |
||
190 | * of the passed configuration will overwrite the this one. |
||
191 | * |
||
192 | * @param \AppserverIo\Routlt\Description\ResultDescriptorInterface $resultDescriptor The configuration to merge |
||
193 | * |
||
194 | * @return void |
||
195 | * @throws \AppserverIo\Routlt\Description\DescriptorException Is thrown if the passed descriptor has a different method name |
||
196 | */ |
||
197 | public function merge(ResultDescriptorInterface $resultDescriptor) |
||
222 | } |
||
223 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.