diff --git a/src/Contracts/Format.php b/src/Contracts/Format.php index 19015f6..b6e0e59 100644 --- a/src/Contracts/Format.php +++ b/src/Contracts/Format.php @@ -1,5 +1,14 @@ + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + namespace Jiannei\Response\Laravel\Contracts; use Illuminate\Http\Resources\Json\JsonResource; @@ -13,7 +22,7 @@ interface Format * * @param array|null $data * @param string|null $message - * @param int $code + * @param int $code * @param null $errors * @return array */ @@ -37,7 +46,7 @@ public function statusCode($code): int; * @param int $option * @return array */ - public function paginator(AbstractPaginator $resource, string $message = '', int $code = 200, array $headers = [], int $option = 0):array; + public function paginator(AbstractPaginator $resource, string $message = '', int $code = 200, array $headers = [], int $option = 0): array; /** * Format collection resource data. @@ -62,4 +71,4 @@ public function resourceCollection(ResourceCollection $resource, string $message * @return array */ public function jsonResource(JsonResource $resource, string $message = '', int $code = 200, array $headers = [], int $option = 0): array; -} \ No newline at end of file +} diff --git a/src/Providers/LaravelServiceProvider.php b/src/Providers/LaravelServiceProvider.php index 9928897..d98e6fd 100644 --- a/src/Providers/LaravelServiceProvider.php +++ b/src/Providers/LaravelServiceProvider.php @@ -25,7 +25,7 @@ public function boot() $format = $this->app['config']['response']['format']; if (is_string($format) && class_exists($format)) { - $this->app->bind(\Jiannei\Response\Laravel\Support\Format::class,$format); + $this->app->bind(\Jiannei\Response\Laravel\Support\Format::class, $format); } } diff --git a/src/Support/Format.php b/src/Support/Format.php index a10a041..8256bfd 100644 --- a/src/Support/Format.php +++ b/src/Support/Format.php @@ -27,7 +27,7 @@ class Format implements \Jiannei\Response\Laravel\Contracts\Format * * @param array|null $data * @param string|null $message - * @param int $code + * @param int $code * @param null $errors * @return array */ diff --git a/tests/FormatTest.php b/tests/FormatTest.php index e07eef1..103e1e8 100644 --- a/tests/FormatTest.php +++ b/tests/FormatTest.php @@ -1,5 +1,14 @@ + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + namespace Jiannei\Response\Laravel\Tests; use Jiannei\Response\Laravel\Support\Facades\Response; @@ -12,7 +21,7 @@ public function testAddExtraField() $this->assertEquals(200, $response->status()); - $this->assertArrayHasKey('extra',$response->getData(true)); - $this->assertArrayHasKey('time',$response->getData(true)['extra']); + $this->assertArrayHasKey('extra', $response->getData(true)); + $this->assertArrayHasKey('time', $response->getData(true)['extra']); } -} \ No newline at end of file +} diff --git a/tests/Support/Format.php b/tests/Support/Format.php index a91488c..f474e64 100644 --- a/tests/Support/Format.php +++ b/tests/Support/Format.php @@ -1,5 +1,14 @@ + * + * This source file is subject to the MIT license that is bundled + * with this source code in the file LICENSE. + */ + namespace Jiannei\Response\Laravel\Tests\Support; use Illuminate\Support\Facades\Config; @@ -19,8 +28,8 @@ public function data(?array $data, ?string $message, int $code, $errors = null): 'data' => $data ?: (object) $data, 'error' => $errors ?: (object) [], 'extra' => [ - 'time' => time() + 'time' => time(), ], ], Config::get('response.format.fields', [])); } -} \ No newline at end of file +} diff --git a/tests/TestCase.php b/tests/TestCase.php index def7d77..d61fb8d 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -43,6 +43,6 @@ protected function defineEnvironment($app) ]); $app['config']->set('response.enum', \Jiannei\Response\Laravel\Tests\Repositories\Enums\ResponseCodeEnum::class); - $app['config']->set('response.format',\Jiannei\Response\Laravel\Tests\Support\Format::class); + $app['config']->set('response.format', \Jiannei\Response\Laravel\Tests\Support\Format::class); } }