/**
  * @param string The requested URL
  * @param string|NULL $method The request method or NULL if the value from $_SERVER should be used
  * @param array|NULL The GET parameter or NULL if $_GET should be used
  * @param array|NULL The POST parameter or NULL if $_POST should be used
  * @param array|NULL The COOKIE parameter or NULL if $_COOKIE should be used
  * @param array|NULL The FILES parameters or NULL if $_FILES should be used
  * @param array|NULL The SERVER parameters or NULL if $_SERVER should be used
  */
 public function __construct($app_dir, $url, $method = NULL, $get = NULL, $post = NULL, $cookie = NULL, $files = NULL, $server = NULL, $is_ajax = NULL, $cache_dir = "/tmp", $config = "config.php")
 {
     parent::__construct($app_dir, $cache_dir, $config, FALSE);
     if ($method === NULL) {
         $method = @$_SERVER['REQUEST_METHOD'] ?: "GET";
     }
     if ($get === NULL) {
         $get = $_GET;
     }
     if ($post === NULL) {
         $post = $_POST;
     }
     if ($cookie === NULL) {
         $cookie = $_COOKIE;
     }
     if ($files === NULL) {
         $files = $_FILES;
     }
     if ($server === NULL) {
         $server = $_SERVER;
     }
     if ($is_ajax === NULL) {
         $is_ajax = !empty($server['HTTP_X_REQUESTED_WITH']) && strtolower($server['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
     }
     $request = new Request($method, $get, $post, $cookie, $files, $server, $is_ajax);
     $response = new Response();
     //initialize context
     $this->getLoops()->registerService("request", $request);
     $this->getLoops()->registerService("response", $response);
     //set url for reference
     $this->url = $url;
     //boot
     $this->boot();
 }
 public function __construct($app_dir, array $arguments, $stdout = NULL, $stderr = NULL, $stdin = NULL, $cache_dir = "/tmp", $config = "config.php")
 {
     $this->flags = new Flags();
     $this->flags->string("app-dir", $app_dir, "Specify the Loops application directory. [Default: {$app_dir}]");
     $this->flags->string("cache-dir", $cache_dir, "Specify the Loops cache directory. [Default: {$cache_dir}]");
     $this->flags->string("config", $config, "Location of the Loops configuration. [Default: {$config}]");
     $this->command = $arguments[0];
     $this->arguments = array_splice($arguments, 1);
     $this->stdout = $stdout ?: STDOUT;
     $this->stderr = $stderr ?: STDERR;
     $this->stdin = $stdin ?: STDIN;
     //parse (do not use overloaded method)
     $options = self::parse(FALSE);
     parent::__construct($options["app-dir"], $options["cache-dir"], $options["config"]);
 }