File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -181,15 +181,19 @@ public function _remap($object_called)
181181 * Takes pure data and optionally a status code, then creates the response
182182 */
183183
184- public function response ($ data = array (), $ http_code = 200 )
184+ public function response ($ data = array (), $ http_code = null )
185185 {
186- if (empty ($ data ))
186+ // If data is empty and not code provide, error and bail
187+ if (empty ($ data ) && $ http_code === null )
187188 {
188189 $ http_code = 404 ;
189190 }
190191
192+ // Otherwise (if no data but 200 provided) or some data, carry on camping!
191193 else
192194 {
195+ is_numeric ($ http_code ) OR $ http_code = 200 ;
196+
193197 // If the format method exists, call and return the output in that format
194198 if (method_exists ($ this , '_format_ ' .$ this ->request ->format ))
195199 {
@@ -637,7 +641,7 @@ private function _force_login($nonce = '')
637641 private function _force_loopable ($ data )
638642 {
639643 // Force it to be something useful
640- if (! is_array ($ data ) AND !is_object ($ data ))
644+ if ( ! is_array ($ data ) AND ! is_object ($ data ))
641645 {
642646 $ data = (array ) $ data ;
643647 }
You can’t perform that action at this time.
0 commit comments