@@ -27,7 +27,7 @@ |
||
| 27 | 27 | if (function_exists('bson_decode')) { |
| 28 | 28 | if ($payload) { |
| 29 | 29 | $bson = bson_decode(trim($payload)); |
| 30 | - if (! $bson) |
|
| 30 | + if (!$bson) |
|
| 31 | 31 | throw new ParserException('Failed To Parse BSON'); |
| 32 | 32 | return $bson; |
| 33 | 33 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | if (function_exists('msgpack_unpack')) { |
| 28 | 28 | if ($payload) { |
| 29 | 29 | $msg = msgpack_unpack(trim($payload)); |
| 30 | - if (! $msg) |
|
| 30 | + if (!$msg) |
|
| 31 | 31 | throw new ParserException('Failed To Parse MSGPack'); |
| 32 | 32 | return $msg; |
| 33 | 33 | } |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | { |
| 27 | 27 | if ($payload) { |
| 28 | 28 | $json = json_decode(trim($payload), true); |
| 29 | - if (! $json) |
|
| 29 | + if (!$json) |
|
| 30 | 30 | throw new ParserException('Failed To Parse JSON'); |
| 31 | 31 | return $json; |
| 32 | 32 | } |
@@ -30,9 +30,9 @@ |
||
| 30 | 30 | |
| 31 | 31 | // Fix for empty values in XML |
| 32 | 32 | $json = json_encode((array) $xml); |
| 33 | - $json = str_replace(':{}',':null', $json); |
|
| 34 | - $json = str_replace(':[]',':null', $json); |
|
| 35 | - return json_decode($json, 1); // Work around to accept xml input |
|
| 33 | + $json = str_replace(':{}', ':null', $json); |
|
| 34 | + $json = str_replace(':[]', ':null', $json); |
|
| 35 | + return json_decode($json, 1); // Work around to accept xml input |
|
| 36 | 36 | } catch (\Exception $ex) { |
| 37 | 37 | throw new ParserException('Failed To Parse XML'); |
| 38 | 38 | } |
@@ -29,28 +29,28 @@ |
||
| 29 | 29 | * @var array Supported Formats |
| 30 | 30 | */ |
| 31 | 31 | private $supported_formats = array ( |
| 32 | - // XML |
|
| 33 | - 'application/xml' => 'xml', |
|
| 34 | - 'text/xml' => 'xml', |
|
| 35 | - // JSON |
|
| 36 | - 'application/json' => 'json', |
|
| 37 | - 'application/x-javascript' => 'json', |
|
| 38 | - 'text/javascript' => 'json', |
|
| 39 | - 'text/x-javascript' => 'json', |
|
| 40 | - 'text/x-json' => 'json', |
|
| 41 | - // BSON |
|
| 32 | + // XML |
|
| 33 | + 'application/xml' => 'xml', |
|
| 34 | + 'text/xml' => 'xml', |
|
| 35 | + // JSON |
|
| 36 | + 'application/json' => 'json', |
|
| 37 | + 'application/x-javascript' => 'json', |
|
| 38 | + 'text/javascript' => 'json', |
|
| 39 | + 'text/x-javascript' => 'json', |
|
| 40 | + 'text/x-json' => 'json', |
|
| 41 | + // BSON |
|
| 42 | 42 | 'application/bson' => 'bson', |
| 43 | - // YAML |
|
| 44 | - 'text/yaml' => 'yaml', |
|
| 45 | - 'text/x-yaml' => 'yaml', |
|
| 46 | - 'application/yaml' => 'yaml', |
|
| 47 | - 'application/x-yaml' => 'yaml', |
|
| 48 | - // MSGPACK |
|
| 43 | + // YAML |
|
| 44 | + 'text/yaml' => 'yaml', |
|
| 45 | + 'text/x-yaml' => 'yaml', |
|
| 46 | + 'application/yaml' => 'yaml', |
|
| 47 | + 'application/x-yaml' => 'yaml', |
|
| 48 | + // MSGPACK |
|
| 49 | 49 | 'application/msgpack' => 'msgpack', |
| 50 | 50 | 'application/x-msgpack' => 'msgpack', |
| 51 | - // MISC |
|
| 52 | - 'application/vnd.php.serialized' => 'serialize', |
|
| 53 | - 'application/x-www-form-urlencoded' => 'querystr' |
|
| 51 | + // MISC |
|
| 52 | + 'application/vnd.php.serialized' => 'serialize', |
|
| 53 | + 'application/x-www-form-urlencoded' => 'querystr' |
|
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | 56 | /* ------------ Access Methods/Helpers ------------ */ |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | /** |
| 29 | 29 | * @var array Supported Formats |
| 30 | 30 | */ |
| 31 | - private $supported_formats = array ( |
|
| 31 | + private $supported_formats = array( |
|
| 32 | 32 | // XML |
| 33 | 33 | 'application/xml' => 'xml', |
| 34 | 34 | 'text/xml' => 'xml', |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | public function getFormat($format = '') |
| 192 | 192 | { |
| 193 | - if (! empty($format)) { |
|
| 193 | + if (!empty($format)) { |
|
| 194 | 194 | return $this->processContentType($format); |
| 195 | 195 | } |
| 196 | 196 | |
@@ -382,13 +382,13 @@ discard block |
||
| 382 | 382 | } else { |
| 383 | 383 | $item = array_shift($data); |
| 384 | 384 | } |
| 385 | - $data =& $item; |
|
| 385 | + $data = & $item; |
|
| 386 | 386 | |
| 387 | 387 | } else { |
| 388 | 388 | if (!isset($data[$key]) || !is_array($data[$key])) |
| 389 | 389 | return false; |
| 390 | 390 | |
| 391 | - $data =& $data[$key]; |
|
| 391 | + $data = & $data[$key]; |
|
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | } else { |
| 440 | 440 | $item = array_shift($data); |
| 441 | 441 | } |
| 442 | - $data =& $item; |
|
| 442 | + $data = & $item; |
|
| 443 | 443 | |
| 444 | 444 | } else { |
| 445 | 445 | if (!isset($data[$key])) |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | if ($data[$key] === '') |
| 452 | 452 | return false; |
| 453 | 453 | |
| 454 | - $data =& $data[$key]; |
|
| 454 | + $data = & $data[$key]; |
|
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | return true; |
@@ -489,12 +489,12 @@ discard block |
||
| 489 | 489 | { |
| 490 | 490 | $key = array_shift($keys); |
| 491 | 491 | |
| 492 | - if ( ! isset($array[$key]) || ! is_array($array[$key])) |
|
| 492 | + if (!isset($array[$key]) || !is_array($array[$key])) |
|
| 493 | 493 | { |
| 494 | 494 | return; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - $array =& $array[$key]; |
|
| 497 | + $array = & $array[$key]; |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | unset($array[array_shift($keys)]); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public function register() |
| 29 | 29 | { |
| 30 | - $this->app->bind('Parser', function ($app) { |
|
| 30 | + $this->app->bind('Parser', function($app) { |
|
| 31 | 31 | return new Parser; |
| 32 | 32 | }); |
| 33 | 33 | } |