Exemplo n.º 1
0
 /**
  * Constructor
  *
  * @param boolean $productionMode    When set to false, it will run in
  *                                   debug mode and parse the class files
  *                                   every time to map it to the URL
  *
  * @param bool    $refreshCache      will update the cache when set to true
  */
 public function __construct($productionMode = false, $refreshCache = false)
 {
     parent::__construct();
     $this->startTime = time();
     Util::$restler = $this;
     Scope::set('Restler', $this);
     $this->productionMode = $productionMode;
     if (is_null(Defaults::$cacheDirectory)) {
         Defaults::$cacheDirectory = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR . 'cache';
     }
     $this->cache = new Defaults::$cacheClass();
     $this->refreshCache = $refreshCache;
     // use this to rebuild cache every time in production mode
     if ($productionMode && $refreshCache) {
         $this->cached = false;
     }
 }
Exemplo n.º 2
0
 /**
  * Constructor
  *
  * @param boolean $productionMode When set to false, it will run in
  *                                   debug mode and parse the class files
  *                                   every time to map it to the URL
  *
  * @param bool $refreshCache will update the cache when set to true
  * @param bool $enableRouteCache
  */
 public function __construct($productionMode = false, $refreshCache = false, $enableRouteCache = false)
 {
     parent::__construct();
     $this->startTime = time();
     Util::$restler = $this;
     Scope::set('Restler', $this);
     $this->productionMode = $productionMode;
     $this->enableRouteCache = $enableRouteCache;
     if (is_null(Defaults::$cacheDirectory)) {
         Defaults::$cacheDirectory = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR . 'cache';
     }
     if ($enableRouteCache) {
         $this->cache = new Defaults::$cacheClass();
         $this->refreshCache = $refreshCache;
         // use this to rebuild cache every time in production mode
         if ($productionMode && $refreshCache) {
             $this->cached = false;
         }
     }
     $this->headerData = new \Luracast\Restler\Data\Response\Header();
     $this->requestFromObject = null;
 }