Пример #1
0
 public static function _init()
 {
     if (!Kohana::$is_cli) {
         throw new Exception('Cli class cannot be used outside of the command line.');
     }
     if (!isset(self::$_args)) {
         for ($i = 1; $i < $_SERVER['argc']; $i++) {
             $arg = explode('=', $_SERVER['argv'][$i]);
             self::$_args[$i] = $arg[0];
             if (count($arg) > 1 || strncmp($arg[0], '-', 1) === 0) {
                 self::$_args[ltrim($arg[0], '-')] = isset($arg[1]) ? $arg[1] : true;
             }
         }
     }
     // Readline is an extension for PHP that makes interactive with PHP much more bash-like
     // http://www.php.net/manual/en/readline.installation.php
     self::$readline_support = extension_loaded('readline');
 }