<?php
# Date: 30.09.2020 (09:42)
namespace Battles;
class Template
{
    /**
     * Template constructor.
     */
    public function __construct()
    {
    }

    /**
     * @param string|null $title
     * @param int|null    $return
     *
     * @return false|string
     */
    public static function header(string $title = null, int $return = null)
    {
        $head = <<<HTML_HEADER
<!doctype html>
<html lang="ru">
<meta charset="utf-8">
<link href="/css/main.css" rel="stylesheet">
<link href="/css/btn.css" rel=stylesheet >
<title>$title</title>
HTML_HEADER;
        if (!$return) {
            echo $head;
            return false;
        }
        return $head;
    }

    /**
     * @param string $buildingName название здания
     * @param string $streetName служебное название улицы на которой стоит здание для кнопки возврата.
     * @return void
     */
    public static function buildingTop(string $buildingName, string $streetName): void
    {
        echo <<<HTML
<div style="float: right">
    <button onclick="top.frames['gameframe'].location = 'city.php?$streetName'">Выйти из здания</button>
</div>
<h1>$buildingName</h1>
HTML;
    }
}