Skip to content

Commit

Permalink
Deprecate replacing all options
Browse files Browse the repository at this point in the history
  • Loading branch information
barryvdh committed Jun 26, 2022
1 parent 8afd16d commit 00443b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion src/PDF.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,22 @@ public function loadView(string $view, array $data = [], array $mergeData = [],
}

/**
* Set/Change an option in DomPdf
* Set/Change an option (or array of options) in Dompdf
*
* @param array<string, mixed>|string $attribute
* @param null|mixed $value
* @return $this
*/
public function setOption($attribute, $value = null): self
{
$this->dompdf->getOptions()->set($attribute, $value);
return $this;
}

/**
* Replace all the Options from DomPDF
*
* @deprecated Use setOption to override individual options.
* @param array<string, mixed> $options
*/
public function setOptions(array $options): self
Expand Down
2 changes: 1 addition & 1 deletion tests/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function testView(): void
public function testMagicMethods(): void
{
$pdf = Facade::setBaseHost('host')->setProtocol('protocol')
->loadView('test')->setOptions(['temp_dir' => 'test_dir'])
->loadView('test')->setOption(['temp_dir' => 'test_dir'])
->setHttpContext(['ssl' => []]);
/** @var Response $response */
$response = $pdf->download('test.pdf');
Expand Down

0 comments on commit 00443b3

Please sign in to comment.