This commit is contained in:
2024-07-10 12:42:50 +03:00
parent e588866a92
commit 1c31a4e5c3
22 changed files with 2474 additions and 91 deletions

48
console/ConsoleApp.php Executable file
View File

@ -0,0 +1,48 @@
<?php
namespace core\console;
use core\App;
use core\Database;
use Phroute\Phroute\Dispatcher;
class ConsoleApp extends App
{
public $argv;
public function run()
{
$this->setMods();
if(!$rout = $this->getRout()){
echo "Not found \n";
exit();
}
App::$db = new Database();
$dispatcher = new Dispatcher(App::$collector->getData());
$response = $dispatcher->dispatch('GET', $rout);
echo $response;
}
public function setArgv($argv)
{
$this->argv = $argv;
return $this;
}
private function getRout()
{
if(isset($this->argv[1])){
return $this->argv[1];
}
return null;
}
public static function start()
{
return new self();
}
}