<?php

use Core\Config;
use Insallah\Tournaments\Tournament;

error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', 'Off');
date_default_timezone_set('Europe/Moscow');

header('Cache-Control: no-cache, no-store, must-revalidate');
header('Pragma: no-cache');
header('Expires: 0');

require_once 'mysql_override.php';

// Для всех доработок, пока нет автозагрузки классов.
require_once 'class/Insallah/Config.php';

// Попробуем в автозагрузку.
// Никогда не заработает с такими названиями классов и файлов!
// "На потом."
spl_autoload_register(function ($className) {
    # 1 with namespaces
    # 2 without
    $fileName = [
        __DIR__ . '/class/' . str_replace('\\', '/', $className . '.php'),
        __DIR__ . '/class/' . $className . '.php'
        ];
    foreach ($fileName as $file) {
        if (file_exists($file)) {
            require_once $file;
            break;
        }
    }
});

$code = '1';
Config::init();
$c = Config::get();

//Tournament::startAllBattles();