diff options
| author | Juuso Lapinlampi <wub@partyvan.eu> | 2015-09-30 00:02:55 +0200 |
|---|---|---|
| committer | Juuso Lapinlampi <wub@partyvan.eu> | 2015-09-30 00:02:55 +0200 |
| commit | 6d8b20475b4d744764410178854451101468aef7 (patch) | |
| tree | 5faef0f5642d13dec6efa41f37aeb53311376d72 | |
| parent | fb23dde10af35eea3b0f0b14459630305618ac3a (diff) | |
Sort Response code lines alphabetically again
This commit improves readability.
| -rwxr-xr-x | static/classes/Response.class.php | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/static/classes/Response.class.php b/static/classes/Response.class.php index cb34ab4..bfc708a 100755 --- a/static/classes/Response.class.php +++ b/static/classes/Response.class.php @@ -41,14 +41,14 @@ class Response header('Content-Type: text/html; charset=UTF-8'); $this->type = $response_type; break; - case 'text': - header('Content-Type: text/plain; charset=UTF-8'); - $this->type = $response_type; - break; case 'json': header('Content-Type: application/json; charset=UTF-8'); $this->type = $response_type; break; + case 'text': + header('Content-Type: text/plain; charset=UTF-8'); + $this->type = $response_type; + break; default: http_response_code(400); echo 'Invalid response type. Valid options are: csv, html, text, json.'; @@ -67,12 +67,12 @@ class Response case 'html': $response = $this->html_error($code, $desc); break; - case 'text': - $response = $this->text_error($code, $desc); - break; case 'json': $response = $this->json_error($code, $desc); break; + case 'text': + $response = $this->text_error($code, $desc); + break; } http_response_code($code); @@ -90,12 +90,12 @@ class Response case 'html': $response = $this->html_success($files); break; - case 'text': - $response = $this->text_success($files); - break; case 'json': $response = $this->json_success($files); break; + case 'text': + $response = $this->text_success($files); + break; } http_response_code(200); @@ -134,20 +134,6 @@ class Response return $result; } - private static function text_error($code, $description) - { - return 'ERROR: ('.$code.') '.$description; - } - - private static function text_success($files) - { - foreach ($files as $file) { - $result .= $file['url']."\n"; - } - - return $result; - } - private static function json_error($code, $description) { return json_encode(array( @@ -164,4 +150,17 @@ class Response 'files' => $files, )); } + private static function text_error($code, $description) + { + return 'ERROR: ('.$code.') '.$description; + } + + private static function text_success($files) + { + foreach ($files as $file) { + $result .= $file['url']."\n"; + } + + return $result; + } } |
