diff --git a/database/migrations/create_document_files_table.php b/database/migrations/create_document_files_table.php index 29fd941..bc8ec8d 100644 --- a/database/migrations/create_document_files_table.php +++ b/database/migrations/create_document_files_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('document_files', function (Blueprint $table) { diff --git a/database/migrations/create_document_templates_table.php b/database/migrations/create_document_templates_table.php index eb44eb5..cd0d0d8 100644 --- a/database/migrations/create_document_templates_table.php +++ b/database/migrations/create_document_templates_table.php @@ -4,7 +4,8 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration { +return new class extends Migration +{ public function up(): void { Schema::create('document_templates', function (Blueprint $table) { diff --git a/src/Contract/Driver.php b/src/Contract/Driver.php index ce660b6..51c1122 100644 --- a/src/Contract/Driver.php +++ b/src/Contract/Driver.php @@ -6,10 +6,6 @@ interface Driver { /** * Render HTML to PDF and return temporary file path of the rendered PDF. - * - * @param string $html - * @param array $options - * @return string */ public function render(string $html, array $options = []): string; } diff --git a/src/DocumentManager.php b/src/DocumentManager.php index 4e09acf..e09db26 100755 --- a/src/DocumentManager.php +++ b/src/DocumentManager.php @@ -3,8 +3,8 @@ namespace AsevenTeam\Documents; use AsevenTeam\Documents\Contract\Driver; -use AsevenTeam\Documents\Drivers\DriverDecorator; use AsevenTeam\Documents\Drivers\BrowsershotDriver; +use AsevenTeam\Documents\Drivers\DriverDecorator; use Illuminate\Support\Str; use InvalidArgumentException; @@ -18,7 +18,7 @@ protected function getDefaultDriver(): string return config('documents.default_driver'); } - public function driver(?string $driver = null): DriverDecorator + public function driver(string $driver = null): DriverDecorator { $driver ??= $this->getDefaultDriver(); diff --git a/src/Drivers/DriverDecorator.php b/src/Drivers/DriverDecorator.php index b4558b5..f786174 100644 --- a/src/Drivers/DriverDecorator.php +++ b/src/Drivers/DriverDecorator.php @@ -14,8 +14,7 @@ class DriverDecorator implements Driver { public function __construct( protected Driver $driver, - ) - { + ) { } public function create( @@ -23,9 +22,8 @@ public function create( DocumentTemplate $template, array $variables = [], array $options = [], - ?string $documentType = null, - ): DocumentFile - { + string $documentType = null, + ): DocumentFile { $variables = array_merge($template->variables, $variables); $options = array_merge($template->options, $options); @@ -47,9 +45,8 @@ public function createFromHtml( HasDocuments $model, string $html, array $options = [], - ?string $documentType = null, - ): DocumentFile - { + string $documentType = null, + ): DocumentFile { $filePath = $this->renderHtml($html, $options); $size = Storage::fileSize($filePath); @@ -79,7 +76,7 @@ protected function renderHtml(string $html, array $options): string protected function savePdf(string $pdfContent): string { $filename = Str::random(40); - $path = date('Y/m/') . 'documents/' . $filename . '.pdf'; + $path = date('Y/m/').'documents/'.$filename.'.pdf'; Storage::put($path, $pdfContent, ['visibility' => 'public']); diff --git a/tests/TestCase.php b/tests/TestCase.php index c8ae9e6..1a4297f 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -3,7 +3,6 @@ namespace AsevenTeam\Documents\Tests; use AsevenTeam\Documents\DocumentServiceProvider; -use AsevenTeam\Documents\Tests\TestModels\TestModel; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema;