Newwebshop/classes/Shop.php

62 lines
1.3 KiB
PHP

<?php
/**
* Copyright seit 2024 Webshop System
*
* Repräsentiert einen Webshop (Mandantenfähigkeit möglich)
*
* @author Webshop System
* @license GPL v3
*/
class Shop
{
/** @var int */
public $id;
/** @var string */
public $name;
/** @var string */
public $domain;
/** @var string */
public $domain_ssl;
/** @var string */
public $physical_uri;
/** @var string */
public $theme;
public function __construct($id = 1)
{
// TODO: Shop-Daten aus DB laden
$this->id = $id;
$this->name = 'Mein Webshop';
$this->domain = $_SERVER['HTTP_HOST'] ?? 'localhost';
$this->domain_ssl = $_SERVER['HTTP_HOST'] ?? 'localhost';
$this->physical_uri = '/';
$this->theme = 'classic';
}
public static function initialize()
{
// TODO: Mandantenfähigkeit später
return new Shop(1);
}
public function getBaseURI()
{
return $this->physical_uri;
}
public function getGroup()
{
// Dummy-Objekt für Gruppenfunktionen
return (object)[
'id' => 1,
'share_order' => false
];
}
public function getUrlsSharedCart()
{
// Dummy für getUrlsSharedCart
return [$this->domain];
}
}