From 49f969607ce365d2f2cf907629b401b275d08c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Rock=C3=A9tt?= Date: Sun, 15 Oct 2023 19:25:30 +0200 Subject: [PATCH] wip v8 --- composer.json | 3 ++- src/Objects/Config.php | 22 +++++++++++----------- src/Provider.php | 30 +++++++++++++++--------------- src/Service.php | 10 +++++----- stout.json | 2 +- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/composer.json b/composer.json index e2891de..b00980c 100644 --- a/composer.json +++ b/composer.json @@ -53,6 +53,7 @@ ], "dump": "composer dumpautoload", "pest": "./vendor/bin/pest", - "format": "./vendor/bin/stout --dirty" + "format": "./vendor/bin/stout --dirty", + "format-all": "./vendor/bin/stout" } } diff --git a/src/Objects/Config.php b/src/Objects/Config.php index c6b131c..cdfb0a4 100644 --- a/src/Objects/Config.php +++ b/src/Objects/Config.php @@ -25,17 +25,6 @@ public function __construct( $this->expandEnums(); } - private function expandEnums(): void - { - if (is_string($this->pdfVariant)) { - $this->pdfVariant = PDFVariant::tryFrom($this->pdfVariant); - } - - if (is_string($this->pdfVersion)) { - $this->pdfVersion = PDFVersion::tryFrom($this->pdfVersion); - } - } - public function toArray(): array { return [ @@ -52,4 +41,15 @@ public function toArray(): array 'pdfVersion' => $this->pdfVersion?->value, ]; } + + private function expandEnums(): void + { + if (is_string($this->pdfVariant)) { + $this->pdfVariant = PDFVariant::tryFrom($this->pdfVariant); + } + + if (is_string($this->pdfVersion)) { + $this->pdfVersion = PDFVersion::tryFrom($this->pdfVersion); + } + } } diff --git a/src/Provider.php b/src/Provider.php index 6b496f4..5107b36 100644 --- a/src/Provider.php +++ b/src/Provider.php @@ -9,21 +9,6 @@ class Provider extends ServiceProvider { - protected function name(): string - { - return 'weasyprint'; - } - - protected function identifierFor(string $suffix): string - { - return "{$this->name()}.$suffix"; - } - - protected function configFile(): string - { - return __DIR__ . '/../config/weasyprint.php'; - } - public function register(): void { $this->app->scoped(Factory::class, Service::class); @@ -43,4 +28,19 @@ public function boot(): void key: $this->name() ); } + + protected function name(): string + { + return 'weasyprint'; + } + + protected function identifierFor(string $suffix): string + { + return "{$this->name()}.$suffix"; + } + + protected function configFile(): string + { + return __DIR__ . '/../config/weasyprint.php'; + } } diff --git a/src/Service.php b/src/Service.php index 7c04f20..1b6841c 100644 --- a/src/Service.php +++ b/src/Service.php @@ -104,11 +104,6 @@ public function build(): Output )->getOutput(); } - private function processPipeline(PipelineContract $pipeline): BuildTraveler - { - return $pipeline->process(new BuildTraveler($this)); - } - public function download(string $filename, array $headers = [], bool $inline = false): StreamedResponse { return $this->build()->download($filename, $headers, $inline); @@ -128,4 +123,9 @@ public function getData(): string { return $this->build()->getData(); } + + private function processPipeline(PipelineContract $pipeline): BuildTraveler + { + return $pipeline->process(new BuildTraveler($this)); + } } diff --git a/stout.json b/stout.json index 75a2c5e..6236440 100644 --- a/stout.json +++ b/stout.json @@ -22,9 +22,9 @@ "method_chaining_indentation": true, "no_unused_imports": true, "no_useless_else": true, + "ordered_class_elements": true, "ordered_imports": true, "ordered_interfaces": true, - "protected_to_private": true, "return_assignment": true, "self_static_accessor": true, "single_import_per_statement": false,