Files
scummvm-web/include/Pages/StaticPage.php
T
Thunderforge 0ddd37e5f7 WEB: Fixing lint errors
Ran `composer lint` and accepted its auto-fixes
2021-11-10 18:22:34 +01:00

28 lines
621 B
PHP

<?php
namespace ScummVM\Pages;
use Exception;
use ScummVM\Controller;
class StaticPage extends Controller
{
const FILE_NOT_FOUND = 'The filename %s could not be found';
private $filename;
public function __construct($key)
{
parent::__construct();
$this->filename = "html/$key.html";
if (!is_file($this->filename) || !is_readable($this->filename)) {
throw new \ErrorException(\sprintf(self::FILE_NOT_FOUND, $this->filename));
}
}
/* Display the index page. */
public function index($data = null)
{
readfile($this->filename);
}
}