Skip to content

Commit dbfbdcd

Browse files
committed
addSchema
1 parent 2dcc5ef commit dbfbdcd

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

src/SeoManager.php

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function current(): static
4242
}
4343

4444
/**
45-
* @param null|Standard|(Closure(Standard):null|Standard) $value
45+
* @param null|Standard|(Closure(Standard):(null|Standard)) $value
4646
* @return $this
4747
*/
4848
public function setStandard(null|Standard|Closure $value): static
@@ -57,7 +57,7 @@ public function setStandard(null|Standard|Closure $value): static
5757
}
5858

5959
/**
60-
* @param null|OpenGraph|(Closure(OpenGraph):null|OpenGraph) $value
60+
* @param null|OpenGraph|(Closure(OpenGraph):(null|OpenGraph)) $value
6161
* @return $this
6262
*/
6363
public function setOpengraph(null|OpenGraph|Closure $value): static
@@ -72,7 +72,7 @@ public function setOpengraph(null|OpenGraph|Closure $value): static
7272
}
7373

7474
/**
75-
* @param null|Card|(Closure(Card):null|Card) $value
75+
* @param null|Card|(Closure(Card):(null|Card)) $value
7676
* @return $this
7777
*/
7878
public function setTwitter(null|Card|Closure $value): static
@@ -87,7 +87,7 @@ public function setTwitter(null|Card|Closure $value): static
8787
}
8888

8989
/**
90-
* @param null|WebPage|(Closure(WebPage):null|WebPage) $value
90+
* @param null|WebPage|(Closure(WebPage):(null|WebPage)) $value
9191
* @return $this
9292
*/
9393
public function setWebpage(null|WebPage|Closure $value): static
@@ -101,6 +101,33 @@ public function setWebpage(null|WebPage|Closure $value): static
101101
return $this;
102102
}
103103

104+
/**
105+
* @param null|Schema[]|(Closure(Schema[]):(null|Schema[])) $value
106+
* @return $this
107+
*/
108+
public function setSchemas(null|array|Closure $value): static
109+
{
110+
if ($value instanceof Closure) {
111+
$this->schemas = $value($this->schemas ?? []);
112+
} else {
113+
$this->schemas = $value;
114+
}
115+
116+
return $this;
117+
}
118+
119+
/**
120+
* @return $this
121+
*/
122+
public function addSchema(Schema $value): static
123+
{
124+
return $this->setSchemas(function ($schemas) use ($value) {
125+
$schemas[] = $value;
126+
127+
return $schemas;
128+
});
129+
}
130+
104131
public function setTitle(string $value): static
105132
{
106133
if ($this->standard) {

0 commit comments

Comments
 (0)