Created
December 10, 2014 15:38
-
-
Save ChrisFrench/6ae7a595461d8b560c4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Api\Site\Controllers; | |
class Base extends \Dsc\Controller { | |
public function getInputs() { | |
$array = (array) json_decode( file_get_contents('php://input') ); | |
if(empty($array)) { | |
$array = $this->input->getArray(); | |
} | |
return $array; | |
} | |
public function afterroute() { | |
echo $this->outputJson ( $this->getJsonResponse ( $this->app->get('results') ) ); | |
} | |
public function apiError($message, $code = 400) { | |
echo $this->outputJson ( $this->getJsonResponse ( array ( | |
'message' => $message, | |
'code' => $code | |
) ) ); | |
die (); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment