62 lines
2.3 KiB
PHP
62 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Jinove\Vinoteca;
|
|
|
|
use Jinove\Vinoteca\Catalog\PriceRange;
|
|
|
|
final class StoreSchema
|
|
{
|
|
private const OPENS = "10:00";
|
|
private const CLOSES = "21:00";
|
|
private const COUNTRY = "RU";
|
|
private const CURRENCY = "RUB";
|
|
private const DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
|
|
|
public static function graph(array $contacts, string $description, string $street, string $city): array
|
|
{
|
|
$host = Config::host();
|
|
$store = $host . "/#store";
|
|
|
|
return [
|
|
"@context" => "https://schema.org",
|
|
"@graph" => [
|
|
[
|
|
"@type" => "LiquorStore",
|
|
"@id" => $store,
|
|
"name" => "Vinoteca",
|
|
"description" => $description,
|
|
"url" => $host . SITE_DIR,
|
|
"logo" => $host . SITE_TEMPLATE_PATH . "/assets/brand/vinoteca-icon-512.png",
|
|
"image" => $host . SITE_TEMPLATE_PATH . "/assets/media/og-home.jpg",
|
|
"telephone" => $contacts["phone"],
|
|
"email" => $contacts["email"],
|
|
"address" => [
|
|
"@type" => "PostalAddress",
|
|
"streetAddress" => $street,
|
|
"addressLocality" => $city,
|
|
"addressCountry" => self::COUNTRY,
|
|
],
|
|
"openingHoursSpecification" => [[
|
|
"@type" => "OpeningHoursSpecification",
|
|
"dayOfWeek" => array_map(static fn(string $day): string => "https://schema.org/" . $day, self::DAYS),
|
|
"opens" => self::OPENS,
|
|
"closes" => self::CLOSES,
|
|
]],
|
|
"currenciesAccepted" => self::CURRENCY,
|
|
"priceRange" => PriceRange::get(),
|
|
"sameAs" => [$contacts["telegram"]],
|
|
],
|
|
[
|
|
"@type" => "WebSite",
|
|
"@id" => $host . SITE_DIR . "#website",
|
|
"url" => $host . SITE_DIR,
|
|
"name" => "Vinoteca",
|
|
"inLanguage" => LANGUAGE_ID,
|
|
],
|
|
],
|
|
];
|
|
}
|
|
}
|