some fix
This commit is contained in:
1 parent
e588866a92
commit
1c31a4e5c3
22 files changed
+2474
-91
No files matched your search
Executable
+48
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user