Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 25 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| OlzMapData | |
0.00% |
0 / 25 |
|
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 1 |
| getHtml | |
0.00% |
0 / 25 |
|
0.00% |
0 / 1 |
12 | |||
| 1 | <?php |
| 2 | |
| 3 | // ============================================================================= |
| 4 | // Strukturierte Daten (siehe https://schema.org) zur OL Zimmerberg. |
| 5 | // ============================================================================= |
| 6 | |
| 7 | namespace Olz\Components\Schema\OlzMapData; |
| 8 | |
| 9 | use Olz\Components\Common\OlzComponent; |
| 10 | |
| 11 | /** @extends OlzComponent<array<string, mixed>> */ |
| 12 | class OlzMapData extends OlzComponent { |
| 13 | public function getHtml(mixed $args): string { |
| 14 | $name = $args['name'] ?? ''; |
| 15 | $year = $args['year'] ?? ''; |
| 16 | $scale = $args['scale'] ?? ''; |
| 17 | $year_description = $year ? " (Stand {$year})" : ''; |
| 18 | $scale_description = $scale ? " im Massstab {$scale}" : ''; |
| 19 | $olz_link_data = [ |
| 20 | '@type' => 'SportsOrganization', |
| 21 | 'identifier' => 'https://olzimmerberg.ch', |
| 22 | 'url' => 'https://olzimmerberg.ch', |
| 23 | 'name' => 'OL Zimmerberg', |
| 24 | ]; |
| 25 | $map_data = [ |
| 26 | '@context' => 'https://schema.org', |
| 27 | '@type' => 'Map', |
| 28 | 'mapType' => 'https://schema.org/VenueMap', |
| 29 | 'name' => $name, |
| 30 | 'description' => "Die Orientierungslaufkarte \"{$name}\"{$year_description}{$scale_description}, herausgegeben von der OL Zimmerberg.", |
| 31 | 'maintainer' => $olz_link_data, |
| 32 | 'provider' => $olz_link_data, |
| 33 | ]; |
| 34 | $json_map_data = json_encode($map_data); |
| 35 | return <<<ZZZZZZZZZZ |
| 36 | <script type="application/ld+json"> |
| 37 | {$json_map_data} |
| 38 | </script> |
| 39 | ZZZZZZZZZZ; |
| 40 | } |
| 41 | } |