Skip to content

Commit

Permalink
wip v8
Browse files Browse the repository at this point in the history
  • Loading branch information
mikerockett committed Oct 15, 2023
1 parent 441170c commit 49f9696
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 33 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
22 changes: 11 additions & 11 deletions src/Objects/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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);
}
}
}
30 changes: 15 additions & 15 deletions src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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';
}
}
10 changes: 5 additions & 5 deletions src/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -128,4 +123,9 @@ public function getData(): string
{
return $this->build()->getData();
}

private function processPipeline(PipelineContract $pipeline): BuildTraveler
{
return $pipeline->process(new BuildTraveler($this));
}
}
2 changes: 1 addition & 1 deletion stout.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 49f9696

Please sign in to comment.