@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | if (static::peekPath() == 'json') { |
38 | 38 | // check access for API response modes |
39 | 39 | static::$responseMode = static::shiftPath(); |
40 | - if (in_array(static::$responseMode, ['json','jsonp'])) { |
|
40 | + if (in_array(static::$responseMode, ['json', 'jsonp'])) { |
|
41 | 41 | if (!static::checkAPIAccess()) { |
42 | 42 | return static::throwAPIUnAuthorizedError(); |
43 | 43 | } |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | public static function handleRecordsRequest($action = false) |
52 | 52 | { |
53 | 53 | switch ($action ? $action : $action = static::shiftPath()) { |
54 | - case 'save': |
|
55 | - { |
|
54 | + case 'save' : { |
|
56 | 55 | return static::handleMultiSaveRequest(); |
57 | 56 | } |
58 | 57 | |
@@ -190,9 +189,7 @@ discard block |
||
190 | 189 | } |
191 | 190 | |
192 | 191 | switch ($action ? $action : $action = static::shiftPath()) { |
193 | - case '': |
|
194 | - case false: |
|
195 | - { |
|
192 | + case '' : case false : { |
|
196 | 193 | $className = static::$recordClass; |
197 | 194 | |
198 | 195 | return static::respond(static::getTemplateName($className::$singularNoun), [ |
@@ -235,7 +232,7 @@ discard block |
||
235 | 232 | |
236 | 233 | $PrimaryKey = $className::getPrimaryKey(); |
237 | 234 | |
238 | - static::prepareResponseModeJSON(['POST','PUT']); |
|
235 | + static::prepareResponseModeJSON(['POST', 'PUT']); |
|
239 | 236 | |
240 | 237 | if ($className::fieldExists(key($_REQUEST['data']))) { |
241 | 238 | $_REQUEST['data'] = [$_REQUEST['data']]; |
@@ -316,7 +313,7 @@ discard block |
||
316 | 313 | |
317 | 314 | $PrimaryKey = $className::getPrimaryKey(); |
318 | 315 | |
319 | - static::prepareResponseModeJSON(['POST','PUT','DELETE']); |
|
316 | + static::prepareResponseModeJSON(['POST', 'PUT', 'DELETE']); |
|
320 | 317 | |
321 | 318 | if ($className::fieldExists(key($_REQUEST['data']))) { |
322 | 319 | $_REQUEST['data'] = [$_REQUEST['data']]; |
@@ -406,7 +403,7 @@ discard block |
||
406 | 403 | return static::throwUnauthorizedError(); |
407 | 404 | } |
408 | 405 | |
409 | - if (in_array($_SERVER['REQUEST_METHOD'], ['POST','PUT'])) { |
|
406 | + if (in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT'])) { |
|
410 | 407 | if (static::$responseMode == 'json') { |
411 | 408 | $_REQUEST = JSON::getRequestData(); |
412 | 409 | if (is_array($_REQUEST['data'])) { |
@@ -567,7 +564,7 @@ discard block |
||
567 | 564 | |
568 | 565 | public static function getTemplateName($noun) |
569 | 566 | { |
570 | - return preg_replace_callback('/\s+([a-zA-Z])/', function ($matches) { |
|
567 | + return preg_replace_callback('/\s+([a-zA-Z])/', function($matches) { |
|
571 | 568 | return strtoupper($matches[1]); |
572 | 569 | }, $noun); |
573 | 570 | } |