public function __construct(AppConfig $config)
 {
     parent::__construct($config, null);
     // Don't terminate the script when the cli's tty goes away
     ignore_user_abort(true);
     $this->parseCommand();
 }
 /**
  * Takes an array of options to set the following possible class properties:
  *
  *  - baseURI
  *  - timeout
  *  - any other request options to use as defaults.
  *
  * @param array $options
  */
 public function __construct(AppConfig $config, URI $uri, ResponseInterface $response = null, array $options = [])
 {
     if (!function_exists('curl_version')) {
         throw new \RuntimeException('CURL must be enabled to use the CURLRequest class.');
     }
     parent::__construct($config);
     $this->response = $response;
     $this->baseURI = $uri;
     $this->parseOptions($options);
 }
Example #3
0
 /**
  * Try to Route It - As it sounds like, works with the router to
  * match a route against the current URI. If the route is a
  * "redirect route", will also handle the redirect.
  *
  * @param RouteCollectionInterface $routes  An collection interface to use in place
  *                                          of the config file.
  */
 protected function tryToRouteIt(RouteCollectionInterface $routes = null)
 {
     if (empty($routes) || !$routes instanceof RouteCollectionInterface) {
         require APPPATH . 'Config/Routes.php';
     }
     // $routes is defined in Config/Routes.php
     $this->router = Services::router($routes);
     $path = is_cli() ? $this->request->getPath() : $this->request->uri->getPath();
     $this->benchmark->stop('bootstrap');
     $this->benchmark->start('routing');
     ob_start();
     $this->controller = $this->router->handle($path);
     $this->method = $this->router->methodName();
     $this->benchmark->stop('routing');
 }
 /**
  * Constructor
  * 
  * @param type $config
  * @param type $uri
  * @param type $body
  */
 public function __construct($config, $uri = null, $body = 'php://input')
 {
     // Get our body from php://input
     if ($body == 'php://input') {
         $body = file_get_contents('php://input');
     }
     $this->body = $body;
     parent::__construct($config, $uri);
     $this->populateHeaders();
     $this->uri = $uri;
     $this->detectURI($config->uriProtocol, $config->baseURL);
 }
 public function __construct(AppConfig $config, $uri = null, $body = 'php://input')
 {
     // Get our body from php://input
     if ($body == 'php://input') {
         $body = file_get_contents('php://input');
     }
     $this->body = $body;
     parent::__construct($config, $uri);
     $this->populateHeaders();
     $this->uri = $uri;
     $this->detectURI($config->uriProtocol, $config->baseURL);
     $this->cookiePrefix = $config->cookiePrefix;
     $this->cookieDomain = $config->cookieDomain;
     $this->cookiePath = $config->cookiePath;
     $this->cookieSecure = $config->cookieSecure;
     $this->cookieHTTPOnly = $config->cookieHTTPOnly;
 }