1 | <?php |
||
37 | class ResultConfigurationDescriptor extends AbstractNameAwareDescriptor implements ResultConfigurationDescriptorInterface |
||
38 | { |
||
39 | |||
40 | /** |
||
41 | * The action result type. |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $type; |
||
46 | |||
47 | /** |
||
48 | * The action result value. |
||
49 | * |
||
50 | * @var string |
||
51 | */ |
||
52 | protected $result; |
||
53 | |||
54 | /** |
||
55 | * The HTTP response code that has to be send. |
||
56 | * |
||
57 | * @var string |
||
58 | */ |
||
59 | protected $code = 200; |
||
60 | |||
61 | /** |
||
62 | * Sets the action result type. |
||
63 | * |
||
64 | * @param string $type The action result type |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | 6 | public function setType($type) |
|
69 | { |
||
70 | 6 | $this->type = $type; |
|
71 | 6 | } |
|
72 | |||
73 | /** |
||
74 | * Returns the action result type. |
||
75 | * |
||
76 | * @return string The action result type |
||
77 | */ |
||
78 | 1 | public function getType() |
|
82 | |||
83 | /** |
||
84 | * Sets the action result value. |
||
85 | * |
||
86 | * @param string $result The action result value |
||
87 | * |
||
88 | * @return void |
||
89 | */ |
||
90 | 6 | public function setResult($result) |
|
91 | { |
||
92 | 6 | $this->result = $result; |
|
93 | 6 | } |
|
94 | |||
95 | /** |
||
96 | * Returns the action result value. |
||
97 | * |
||
98 | * @return string The action result value |
||
99 | */ |
||
100 | 1 | public function getResult() |
|
104 | |||
105 | /** |
||
106 | * Sets the HTTP response code that has to be send. |
||
107 | * |
||
108 | * @param integer $code The HTTP response code |
||
109 | * |
||
110 | * @return void |
||
111 | */ |
||
112 | 1 | public function setCode($code) |
|
113 | { |
||
114 | 1 | $this->code = $code; |
|
|
|||
115 | 1 | } |
|
116 | |||
117 | /** |
||
118 | * Returns the HTTP response code that has to be send. |
||
119 | * |
||
120 | * @return integer The HTTP response code |
||
121 | */ |
||
122 | 1 | public function getCode() |
|
126 | |||
127 | /** |
||
128 | * Returns a new descriptor instance. |
||
129 | * |
||
130 | * @return \AppserverIo\Routlt\Description\ResultDescriptorInterface The descriptor instance |
||
131 | */ |
||
132 | 3 | public static function newDescriptorInstance() |
|
136 | |||
137 | /** |
||
138 | * Returns a new annotation instance for the passed reflection class. |
||
139 | * |
||
140 | * @param \AppserverIo\Lang\Reflection\ClassInterface $reflectionClass The reflection class with the bean configuration |
||
141 | * |
||
142 | * @return \AppserverIo\Lang\Reflection\AnnotationInterface The reflection annotation |
||
143 | */ |
||
144 | protected function newAnnotationInstance(ClassInterface $reflectionClass) |
||
148 | |||
149 | /** |
||
150 | * Initializes the bean configuration instance from the passed reflection class instance. |
||
151 | * |
||
152 | * @param \AppserverIo\Lang\Reflection\ClassInterface $reflectionClass The reflection class with the bean configuration |
||
153 | * |
||
154 | * @return \AppserverIo\Routlt\Description\PathDescriptorInterface The initialized descriptor |
||
155 | */ |
||
156 | public function fromReflectionClass(ClassInterface $reflectionClass) |
||
159 | |||
160 | /** |
||
161 | * Initializes the result configuration instance from the passed result annotation instance. |
||
162 | * |
||
163 | * @param \AppserverIo\Routlt\Annotations\Result $annotation The result annotation with the result configuration |
||
164 | * |
||
165 | * @return \AppserverIo\Routlt\Description\ResultDescriptorInterface The initialized descriptor |
||
166 | */ |
||
167 | 6 | public function fromAnnotation(Result $annotation) |
|
183 | |||
184 | /** |
||
185 | * Initializes a action configuration instance from the passed deployment descriptor node. |
||
186 | * |
||
187 | * @param \SimpleXmlElement $node The deployment node with the action configuration |
||
188 | * |
||
189 | * @return \AppserverIo\Routlt\Description\ActionDescriptorInterface The initialized descriptor |
||
190 | */ |
||
191 | 1 | public function fromDeploymentDescriptor(\SimpleXmlElement $node) |
|
194 | |||
195 | /** |
||
196 | * Initializes a action configuration instance from the passed configuration node. |
||
197 | * |
||
198 | * @param \AppserverIo\Configuration\Interfaces\NodeInterface $node The configuration node with the action configuration |
||
199 | * |
||
200 | * @return \AppserverIo\Routlt\Description\ActionDescriptorInterface The initialized descriptor |
||
201 | */ |
||
202 | public function fromConfiguration(NodeInterface $node) |
||
205 | |||
206 | /** |
||
207 | * Merges the passed configuration into this one. Configuration values |
||
208 | * of the passed configuration will overwrite the this one. |
||
209 | * |
||
210 | * @param \AppserverIo\Routlt\Description\ResultConfigurationDescriptorInterface $resultConfigurationDescriptor The configuration to merge |
||
211 | * |
||
212 | * @return void |
||
213 | * @throws \AppserverIo\Routlt\Description\DescriptorException Is thrown if the passed descriptor has a different method name |
||
214 | */ |
||
215 | 2 | public function merge(ResultConfigurationDescriptorInterface $resultConfigurationDescriptor) |
|
240 | } |
||
241 |
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.