@@ -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), [ |
@@ -226,7 +223,7 @@ discard block |
||
| 226 | 223 | |
| 227 | 224 | $PrimaryKey = $className::getPrimaryKey(); |
| 228 | 225 | |
| 229 | - if (static::$responseMode == 'json' && in_array($_SERVER['REQUEST_METHOD'], ['POST','PUT'])) { |
|
| 226 | + if (static::$responseMode == 'json' && in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT'])) { |
|
| 230 | 227 | $JSONData = JSON::getRequestData(); |
| 231 | 228 | if (is_array($JSONData)) { |
| 232 | 229 | $_REQUEST = $JSONData; |
@@ -314,7 +311,7 @@ discard block |
||
| 314 | 311 | |
| 315 | 312 | $PrimaryKey = $className::getPrimaryKey(); |
| 316 | 313 | |
| 317 | - if (static::$responseMode == 'json' && in_array($_SERVER['REQUEST_METHOD'], ['POST','PUT','DELETE'])) { |
|
| 314 | + if (static::$responseMode == 'json' && in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT', 'DELETE'])) { |
|
| 318 | 315 | $JSONData = JSON::getRequestData(); |
| 319 | 316 | if (is_array($JSONData)) { |
| 320 | 317 | $_REQUEST = $JSONData; |
@@ -409,7 +406,7 @@ discard block |
||
| 409 | 406 | return static::throwUnauthorizedError(); |
| 410 | 407 | } |
| 411 | 408 | |
| 412 | - if (in_array($_SERVER['REQUEST_METHOD'], ['POST','PUT'])) { |
|
| 409 | + if (in_array($_SERVER['REQUEST_METHOD'], ['POST', 'PUT'])) { |
|
| 413 | 410 | if (static::$responseMode == 'json') { |
| 414 | 411 | $_REQUEST = JSON::getRequestData(); |
| 415 | 412 | if (is_array($_REQUEST['data'])) { |
@@ -570,7 +567,7 @@ discard block |
||
| 570 | 567 | |
| 571 | 568 | public static function getTemplateName($noun) |
| 572 | 569 | { |
| 573 | - return preg_replace_callback('/\s+([a-zA-Z])/', function ($matches) { |
|
| 570 | + return preg_replace_callback('/\s+([a-zA-Z])/', function($matches) { |
|
| 574 | 571 | return strtoupper($matches[1]); |
| 575 | 572 | }, $noun); |
| 576 | 573 | } |