Beispiel #1
0
 private static function render()
 {
     if (isset($GLOBALS['argc']) && $GLOBALS['argc'] > 0) {
         $argv = $GLOBALS['argv'] ?? [];
         if (!isset($argv[1], $argv[2]) || !in_array($argv[1], Request::METHODS)) {
             if (isset(self::$consoleHandlers[$argv[1]])) {
                 self::$consoleHandlers[$argv[1]](...array_slice($argv, 2));
                 exit;
             }
             echo 'Examples:', PHP_EOL, "\tphp index.php method path[ data]", PHP_EOL, "\tphp index.php get /foo", PHP_EOL, "\tphp index.php get -s /foo/bar a=1&b=2", PHP_EOL, "\tphp index.php post /foo/bar a=1&b=2", PHP_EOL, "\tphp index.php delete /foo/bar a=1&b=2", PHP_EOL, "\t OR", PHP_EOL, "\tphp index.php command[ arguments]";
             exit(1);
         }
     }
     Router::render(self::getRequest());
 }