Skip to content

Commit

Permalink
accept null
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Sep 14, 2024
1 parent 23e3ba6 commit 8be22c3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/SeoManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public function setTitle(string $value): static
return $this;
}

public function setDescription(string $value): static
public function setDescription(?string $value): static
{
if ($this->standard) {
$this->standard->description = $value;
Expand Down Expand Up @@ -216,18 +216,18 @@ public function setUrl(string $value): static
return $this;
}

public function setImage(SeoImage|string $value): static
public function setImage(null|SeoImage|string $value): static
{
$value = $value instanceof SeoImage ? $value : new SeoImage($value);
$value = is_string($value) ? new SeoImage($value) : $value;

if ($this->opengraph) {
$this->opengraph->image = $value->toOpenGraph();
$this->opengraph->image = $value?->toOpenGraph();
}
if ($this->twitter instanceof Summary) {
$this->twitter->image = $value->toTwitter();
$this->twitter->image = $value?->toTwitter();
}
if ($this->webpage) {
$this->webpage->put('image', $value->secure_url ?? $value->url);
$this->webpage->put('image', $value?->secure_url ?? $value?->url);
}

return $this;
Expand Down

0 comments on commit 8be22c3

Please sign in to comment.