mirror of
https://github.com/kevinveenbirkenbach/coding-challenge-online-shop.git
synced 2025-09-18 07:46:01 +02:00
Implemented Navigation
This commit is contained in:
@@ -14,7 +14,10 @@ use controller\order\Order;
|
||||
*/
|
||||
final class Router implements RouterInterface
|
||||
{
|
||||
|
||||
const CONTROLLER='controller';
|
||||
|
||||
const ACTION = 'action';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var CoreInterface
|
||||
@@ -38,10 +41,10 @@ final class Router implements RouterInterface
|
||||
public function route()
|
||||
{
|
||||
if ($this->get) {
|
||||
switch ($this->get['controller']) {
|
||||
switch ($this->get[self::CONTROLLER]) {
|
||||
case 'user':
|
||||
$userController = new User();
|
||||
switch ($this->get['action']) {
|
||||
switch ($this->get[self::ACTION]) {
|
||||
case 'login':
|
||||
return $userController->login();
|
||||
case 'logout':
|
||||
@@ -51,13 +54,13 @@ final class Router implements RouterInterface
|
||||
}
|
||||
case 'product':
|
||||
$productController = new Product($this->core);
|
||||
switch ($this->get['action']) {
|
||||
switch ($this->get[self::ACTION]) {
|
||||
case 'list':
|
||||
return $productController->list(($this->get['color'])?$this->get['color']:null);
|
||||
}
|
||||
case 'order':
|
||||
$orderController = new Order($this->core);
|
||||
switch ($this->get['action']){
|
||||
switch ($this->get[self::ACTION]){
|
||||
case 'store':
|
||||
return $orderController->store();
|
||||
case 'basket':
|
||||
|
Reference in New Issue
Block a user