MicroFrameWork/kernel/console/controllers/MainController.php

38 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2024-07-29 15:57:20 +03:00
<?php
namespace kernel\console\controllers;
2024-12-12 15:04:45 +03:00
use kernel\App;
2024-07-29 15:57:20 +03:00
use kernel\console\ConsoleController;
2024-12-12 15:04:45 +03:00
use kernel\helpers\Debug;
2024-07-29 15:57:20 +03:00
class MainController extends ConsoleController
{
public function indexAction(): void
{
$this->out->r("Привет", "green");
}
2024-12-12 15:04:45 +03:00
public function actionHelp(): void
{
$routs = App::$collector->getData()->getStaticRoutes();
foreach ($routs as $rout => $data){
$additionalInfo = $data['GET'][3];
if (isset($additionalInfo['description']) and $additionalInfo['type'] === "console"){
$this->out->inLine($rout . " - ", "green");
$this->out->inLine($additionalInfo['description'], 'yellow');
$this->out->r("");
if (isset($additionalInfo['params'])){
foreach ($additionalInfo['params'] as $key => $param){
$this->out->inLine($key . " - ", "green");
$this->out->inLine($param, 'yellow');
$this->out->r("");
}
}
$this->out->r("");
}
}
2024-12-12 15:04:45 +03:00
}
2024-07-29 15:57:20 +03:00
}