Skip to content

Commit e0ca188

Browse files
committed
Apply fixes from StyleCI
1 parent 4f9dc62 commit e0ca188

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

config/response.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
'code' => ['alias' => 'code', 'show' => true],
6060
'message' => ['alias' => 'message', 'show' => true],
6161
'error' => ['alias' => 'error', 'show' => true],
62-
'data' => ['alias' => 'data', 'show' => true,],
63-
'data.data' => ['alias' => 'data.data', 'show' => true,],// rows/items/list
62+
'data' => ['alias' => 'data', 'show' => true],
63+
'data.data' => ['alias' => 'data.data', 'show' => true], // rows/items/list
6464
],
6565
],
6666
];

src/Support/Format.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function jsonResource(JsonResource $resource): array
106106
{
107107
$data = array_merge_recursive($resource->resolve(request()), $resource->with(request()), $resource->additional);
108108

109-
return fractal()->item($data, fn() => $data)->serializeWith(ArraySerializer::class)->toArray();
109+
return fractal()->item($data, fn () => $data)->serializeWith(ArraySerializer::class)->toArray();
110110
}
111111

112112
/**
@@ -118,7 +118,7 @@ public function jsonResource(JsonResource $resource): array
118118
*/
119119
protected function formatMessage(int $code, ?string $message): ?string
120120
{
121-
if (!$message && class_exists($enumClass = Config::get('response.enum'))) {
121+
if (! $message && class_exists($enumClass = Config::get('response.enum'))) {
122122
$message = $enumClass::fromValue($code)->description;
123123
}
124124

@@ -194,7 +194,7 @@ protected function formatDataFields(array $data): array
194194
$formatConfig = \config('response.format.config', []);
195195

196196
foreach ($formatConfig as $key => $config) {
197-
if (!Arr::has($data, $key)) {
197+
if (! Arr::has($data, $key)) {
198198
continue;
199199
}
200200

@@ -207,7 +207,7 @@ protected function formatDataFields(array $data): array
207207
$key = $alias;
208208
}
209209

210-
if (!$show) {
210+
if (! $show) {
211211
$data = Arr::except($data, $key);
212212
}
213213
}

src/Support/Traits/JsonResponseTrait.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Illuminate\Http\Resources\Json\ResourceCollection;
1919
use Illuminate\Pagination\AbstractCursorPaginator;
2020
use Illuminate\Pagination\AbstractPaginator;
21-
use Illuminate\Pagination\LengthAwarePaginator;
2221
use Illuminate\Support\Arr;
2322
use Illuminate\Support\Facades\Config;
2423

@@ -207,6 +206,6 @@ public function success($data = [], string $message = '', int $code = 200, array
207206
default => Arr::wrap($data)
208207
};
209208

210-
return $this->formatter->response($this->formatter->format($data,$message,$code), $code, $headers, $option);
209+
return $this->formatter->response($this->formatter->format($data, $message, $code), $code, $headers, $option);
211210
}
212211
}

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function defineEnvironment($app)
4545
$app['config']->set('response.enum', \Jiannei\Response\Laravel\Tests\Repositories\Enums\ResponseCodeEnum::class);
4646
if ($this instanceof FormatTest) {
4747
$app['config']->set('response.format', [
48-
'class' => \Jiannei\Response\Laravel\Tests\Support\Format::class
48+
'class' => \Jiannei\Response\Laravel\Tests\Support\Format::class,
4949
]);
5050
}
5151
}

0 commit comments

Comments
 (0)