diff --git a/config/bytepoint.php b/config/bytepoint.php index 8eb1993..6a1d698 100644 --- a/config/bytepoint.php +++ b/config/bytepoint.php @@ -3,5 +3,5 @@ // config for FlixtechsLabs/Bytepoint return [ 'token' => env('BYTEPOINT_TOKEN', 'Mg.XeviY1dxjW7zrgUGoIKf4aWkCJ7gsnh5mY-7U10hOMAp363A_mAnumdkyJnP'), - 'url' => env('BYTEPOINT_URL', 'https://bytepoint.flixtechs.co.zw/api/v1/images') + 'url' => env('BYTEPOINT_URL', 'https://bytepoint.flixtechs.co.zw/api/v1/images'), ]; diff --git a/src/Bytepoint.php b/src/Bytepoint.php index 944769c..79752de 100755 --- a/src/Bytepoint.php +++ b/src/Bytepoint.php @@ -9,24 +9,18 @@ class Bytepoint { /** * Send image to bytepoint and retrieve optimized image - * - * @param string $source - * @param string $destination - * @param string $fileName - * @param array $options - * @return void */ public function optimize(string $source, string $destination, string $fileName = '', array $options = []): void { $options = array_merge([ - 'type' => 'jpeg' + 'type' => 'jpeg', ], $options); $response = Http::attach('image', file_get_contents($source), $fileName ?: 'image') ->withToken(config('bytepoint.token')) ->acceptJson() ->post(config('bytepoint.url'), [ - 'type' => $options['type'] + 'type' => $options['type'], ]); if ($response->successful()) { @@ -39,10 +33,6 @@ public function optimize(string $source, string $destination, string $fileName = /** * Optimize uploaded file - * - * @param UploadedFile $file - * @param array $options - * @return void */ public function optimizeUploadedFile(UploadedFile $file, array $options = []): void { diff --git a/src/BytepointServiceProvider.php b/src/BytepointServiceProvider.php index 3deeab0..52e15d1 100644 --- a/src/BytepointServiceProvider.php +++ b/src/BytepointServiceProvider.php @@ -2,10 +2,10 @@ namespace FlixtechsLabs\Bytepoint; -use Spatie\LaravelPackageTools\Package; -use Spatie\LaravelPackageTools\PackageServiceProvider; use FlixtechsLabs\Bytepoint\Commands\BytepointCommand; use Illuminate\Http\UploadedFile; +use Spatie\LaravelPackageTools\Package; +use Spatie\LaravelPackageTools\PackageServiceProvider; class BytepointServiceProvider extends PackageServiceProvider { @@ -29,7 +29,7 @@ public function boot(): void parent::boot(); UploadedFile::macro('bytepoint', function (array $options = []) { - app(Bytepoint::class)->optimizeUploadedFile($this, $options); + app(Bytepoint::class)->optimizeUploadedFile($this, $options); return new UploadedFile( $this->getRealPath(), diff --git a/tests/ExampleTest.php b/tests/ExampleTest.php index b6cbfe8..c55b43c 100644 --- a/tests/ExampleTest.php +++ b/tests/ExampleTest.php @@ -1,26 +1,18 @@ toBeTrue(); }); it('can optimize uploaded file', function () { - $file = new UploadedFile(__DIR__ . '/test.jpg', 'test.jpg', null, null, true); + $file = new UploadedFile(__DIR__.'/test.jpg', 'test.jpg', null, null, true); - $size = $file->getSize(); - $type = $file->getMimeType(); + $size = $file->getSize(); + $type = $file->getMimeType(); - $file = $file->bytepoint(['type' => 'webp']); + $file = $file->bytepoint(['type' => 'webp']); - dd($size, $type, $file->getSize(), $file->getMimeType()); + dd($size, $type, $file->getSize(), $file->getMimeType()); }); diff --git a/tests/TestCase.php b/tests/TestCase.php index bacd15e..492e466 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,9 +2,9 @@ namespace FlixtechsLabs\Bytepoint\Tests; +use FlixtechsLabs\Bytepoint\BytepointServiceProvider; use Illuminate\Database\Eloquent\Factories\Factory; use Orchestra\Testbench\TestCase as Orchestra; -use FlixtechsLabs\Bytepoint\BytepointServiceProvider; class TestCase extends Orchestra {