valeriya/mirzaev/marina/system/controllers/core.php

75 lines
1.7 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
declare(strict_types=1);
namespace mirzaev\marina\controllers;
// Файлы проекта
use mirzaev\marina\models\core as model;
// Фреймворк PHP
use mirzaev\minimal\controller;
// Discord framework
use Wohali\OAuth2\Client\Provider\Discord as provider;
/**
* Ядро контроллеров
*
* @package mirzaev\marina\controllers
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
class core extends controller
{
/**
* Постфикс
*/
final public const POSTFIX = '';
/**
* Discord provider
*/
readonly public provider $provider;
/**
* Реестр ошибок
*/
protected array $errors = [];
/**
* Конструктор
*
* @param bool $initialize Инициализировать контроллер?
*/
public function __construct(bool $initialize = true)
{
parent::__construct($initialize);
if ($initialize) {
// Запрошена инициализация
// Инициализация ядра моделей (соединение с базой данных...)
new model();
// Initialize of discord provider
$this->provider = new provider(require '../settings/discord/robot.php');
}
}
/**
* Проверить инициализированность
*
* Проверяет инициализированность свойства в инстанции документа аккаунта из базы данных
*
* @param string $name Название
*
* @return bool Свойство инициализировано?
*/
public function __isset(string $name): bool
{
return match ($name) {
default => isset($this->{$name})
};
}
}