MAPG-43 move existing interfaces into separate namespace
This commit is contained in:
parent
17c0ec73df
commit
5738be5c98
@ -1,8 +0,0 @@
|
||||
<?php namespace MapGuesser\Controller;
|
||||
|
||||
use MapGuesser\View\ViewBase;
|
||||
|
||||
interface ControllerInterface
|
||||
{
|
||||
public function run(): ViewBase;
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
<?php namespace MapGuesser\Controller;
|
||||
|
||||
use MapGuesser\Interfaces\Controller\IController;
|
||||
use MapGuesser\Util\Geo\Bounds;
|
||||
use MapGuesser\View\HtmlView;
|
||||
use MapGuesser\View\JsonView;
|
||||
use MapGuesser\View\ViewBase;
|
||||
use MapGuesser\Interfaces\View\IView;
|
||||
use mysqli;
|
||||
|
||||
class GameController implements ControllerInterface
|
||||
class GameController implements IController
|
||||
{
|
||||
private mysqli $mysql;
|
||||
|
||||
@ -22,7 +23,7 @@ class GameController implements ControllerInterface
|
||||
$this->jsonResponse = $jsonResponse;
|
||||
}
|
||||
|
||||
public function run(): ViewBase
|
||||
public function run(): IView
|
||||
{
|
||||
$bounds = $this->getMapBounds();
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
<?php namespace MapGuesser\Controller;
|
||||
|
||||
use MapGuesser\Interfaces\Controller\IController;
|
||||
use MapGuesser\Util\Geo\Position;
|
||||
use MapGuesser\View\JsonView;
|
||||
use MapGuesser\View\ViewBase;
|
||||
use MapGuesser\Interfaces\View\IView;
|
||||
use mysqli;
|
||||
use RestClient\Client;
|
||||
|
||||
class PositionController implements ControllerInterface
|
||||
class PositionController implements IController
|
||||
{
|
||||
const NUMBER_OF_ROUNDS = 5;
|
||||
const MAX_SCORE = 1000;
|
||||
@ -21,7 +22,7 @@ class PositionController implements ControllerInterface
|
||||
$this->mysql = new mysqli($_ENV['DB_HOST'], $_ENV['DB_USER'], $_ENV['DB_PASSWORD'], $_ENV['DB_NAME']);
|
||||
}
|
||||
|
||||
public function run(): ViewBase
|
||||
public function run(): IView
|
||||
{
|
||||
if (!isset($_SESSION['state']) || $_SESSION['state']['mapId'] !== $this->mapId) {
|
||||
$data = ['error' => 'No valid session found!'];
|
||||
|
8
src/Interfaces/Controller/IController.php
Normal file
8
src/Interfaces/Controller/IController.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php namespace MapGuesser\Interfaces\Controller;
|
||||
|
||||
use MapGuesser\Interfaces\View\IView;
|
||||
|
||||
interface IController
|
||||
{
|
||||
public function run(): IView;
|
||||
}
|
10
src/Interfaces/View/IView.php
Normal file
10
src/Interfaces/View/IView.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php namespace MapGuesser\Interfaces\View;
|
||||
|
||||
interface IView
|
||||
{
|
||||
public function &getData(): array;
|
||||
|
||||
public function &render(): string;
|
||||
|
||||
public function getContentType(): string;
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
<?php namespace MapGuesser\View;
|
||||
|
||||
abstract class ViewBase
|
||||
use MapGuesser\Interfaces\View\IView;
|
||||
|
||||
abstract class ViewBase implements IView
|
||||
{
|
||||
protected array $data;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user