Conditions | 2 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
12 | public static function getJsonld(?array $data, $settings = null): string |
||
|
|||
13 | { |
||
14 | $out = ''; |
||
15 | $jsonld = []; |
||
16 | $schema = []; |
||
17 | |||
18 | foreach ($data as $key => $value) { |
||
19 | $schema['@context'] = 'https://schema.org/'; |
||
20 | $schema['@type'] = 'FAQPage'; |
||
21 | $schema['mainEntity'] = [ |
||
22 | '@type' => 'Question', |
||
23 | 'name' => $value['title'], |
||
24 | 'acceptedAnswer' => [ |
||
25 | '@type' => 'Answer', |
||
26 | 'text' => $value['answer'], |
||
27 | ], |
||
28 | ]; |
||
29 | $jsonld[] = $schema; |
||
30 | } |
||
31 | |||
32 | $out .= '<script type="application/ld+json">' . json_encode($jsonld, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_UNICODE | \JSON_UNESCAPED_SLASHES) . '</script>'; |
||
33 | |||
34 | return $out; |
||
35 | } |
||
37 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.