22
33namespace Justbetter \StatamicStructuredData \Actions ;
44
5- use Illuminate \Http \Request ;
65use Justbetter \StatamicStructuredData \Services \StructuredDataService ;
76use Statamic \Entries \Entry ;
87use Statamic \Facades \Entry as EntryFacade ;
1413
1514class InjectStructuredDataAction
1615{
17- protected $ structuredDataService ;
18-
19- public function __construct (StructuredDataService $ structuredDataService )
20- {
21- $ this ->structuredDataService = $ structuredDataService ;
22- }
16+ public function __construct (protected StructuredDataService $ structuredDataService ) {}
2317
2418 public function execute (): ?string
2519 {
@@ -38,7 +32,7 @@ public function execute(): ?string
3832 return null ;
3933 }
4034
41- protected function handleEntry ($ entry ): ?string
35+ protected function handleEntry (Entry | Page $ entry ): ?string
4236 {
4337 if ($ entry instanceof Page) {
4438 $ entry = $ entry ->entry ();
@@ -53,7 +47,7 @@ protected function handleEntry($entry): ?string
5347 return $ this ->handleScripts ($ entry );
5448 }
5549
56- protected function handleTaxonomy ($ term ): ?string
50+ protected function handleTaxonomy (LocalizedTerm $ term ): ?string
5751 {
5852 $ enabledTaxonomies = config ('justbetter.structured-data.taxonomies ' , []);
5953
@@ -64,7 +58,7 @@ protected function handleTaxonomy($term): ?string
6458 return $ this ->handleScripts ($ term );
6559 }
6660
67- protected function handleScripts ($ item ): ?string
61+ protected function handleScripts (mixed $ item ): ?string
6862 {
6963 $ scripts = $ this ->structuredDataService ->getJsonLdScripts ($ item );
7064
0 commit comments