You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.4 KiB
PHTML
49 lines
1.4 KiB
PHTML
3 years ago
|
<?php
|
||
|
|
||
|
namespace brain\controller;
|
||
|
|
||
|
use Psr\Http\Message\ResponseInterface;
|
||
|
use Psr\Http\Message\ServerRequestInterface;
|
||
|
use brain\controller\DashControl;
|
||
|
use brain\controller\APIControl;
|
||
|
use brain\controller\IndexControl;
|
||
|
|
||
|
class RouteControl
|
||
|
{
|
||
|
public function get(
|
||
|
ServerRequestInterface $request,
|
||
|
ResponseInterface $response,
|
||
|
array $args
|
||
|
): ResponseInterface {
|
||
|
switch (isset($args["first"]) ? $args["first"] : "index") {
|
||
|
case "dashboard":
|
||
|
return DashControl::start($request, $response, $args);
|
||
|
break;
|
||
|
case "api":
|
||
|
return APIControl::get($request, $response, $args);
|
||
|
break;
|
||
|
default:
|
||
|
return IndexControl::start($request, $response, $args);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function post(
|
||
|
ServerRequestInterface $request,
|
||
|
ResponseInterface $response,
|
||
|
array $args
|
||
|
): ResponseInterface {
|
||
|
switch (isset($args["first"]) ? $args["first"] : "index") {
|
||
|
case "api":
|
||
|
//$result = APIControl::post($request, $response, $args);
|
||
|
//var_dump($result);
|
||
|
return APIControl::post($request, $response, $args);
|
||
|
break;
|
||
|
default:
|
||
|
//echo "YES";
|
||
|
//return IndexControl::start($request, $response, $args);
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
}
|