Skip to content

Commit 8c456b9

Browse files
committed
fix response formatter
1 parent 6f3eb09 commit 8c456b9

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/JsonApiResponseFormatter.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,12 @@ public function format($response)
3939
if ($this->prettyPrint) {
4040
$options |= JSON_PRETTY_PRINT;
4141
}
42-
42+
$apiDocument = $response->data;
4343
if ($response->isClientError || $response->isServerError) {
4444
if (ArrayHelper::isAssociative($response->data)) {
4545
$response->data = [$response->data];
4646
}
4747
$apiDocument = ['errors' => $response->data];
48-
} elseif (ArrayHelper::keyExists('data', $response->data)) {
49-
$apiDocument = $response->data;
50-
} else {
51-
$apiDocument = ['meta' => $response->data];
5248
}
5349

5450
$response->content = Json::encode($apiDocument, $options);

src/LinksInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
22
/**
3-
* @link http://www.stombox.com/
4-
* @copyright Copyright (c) 2015 Stombox LLC
5-
* @license http://www.stombox.com/license/
3+
* @author Anton Tuyakhov <atuyakhov@gmail.com>
64
*/
75

86
namespace tuyakhov\jsonapi;

0 commit comments

Comments
 (0)