summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xstatic/classes/Response.class.php47
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;
+ }
}