-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #879 from ga-devfront/feat/connect-new-ui
Feat: connect new UI
- Loading branch information
Showing
18 changed files
with
940 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace PrestaShop\Module\AutoUpgrade\Router; | ||
|
||
use PrestaShop\Module\AutoUpgrade\Controller\WelcomeController; | ||
use PrestaShop\Module\AutoUpgrade\UpgradeContainer; | ||
use Symfony\Component\HttpFoundation\Request; | ||
|
||
class Router | ||
{ | ||
/** | ||
* @var UpgradeContainer | ||
*/ | ||
protected $upgradeContainer; | ||
|
||
public function __construct(UpgradeContainer $upgradeContainer) | ||
{ | ||
$this->upgradeContainer = $upgradeContainer; | ||
} | ||
|
||
const ROUTES = [ | ||
'welcome' => [ | ||
'controller' => WelcomeController::class, | ||
'method' => 'index', | ||
'params' => [], | ||
], | ||
]; | ||
|
||
public function handle(Request $request): string | ||
{ | ||
$route = $request->query->get('route'); | ||
|
||
if (empty(self::ROUTES[$route])) { | ||
throw new \InvalidArgumentException('Oh no! The route does not exist'); | ||
} | ||
$route = self::ROUTES[$route]; | ||
$method = $route['method']; | ||
|
||
return (new $route['controller']($this->upgradeContainer))->$method($request); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.