コード例 #1
0
 /**
  * Singleton instance
  *
  * @return Cola_Router
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
コード例 #2
0
ファイル: Cola.php プロジェクト: hihus/colaphp
 /**
  * Get dispatch info
  *
  * @param boolean $init
  * @return array
  */
 public function getDispatchInfo($init = false)
 {
     if (null === $this->dispatchInfo && $init) {
         $this->router || ($this->router = new Cola_Router());
         if ($urls = self::getConfig('_urls')) {
             $this->router->rules += $urls;
         }
         $this->pathInfo || ($this->pathInfo = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '');
         $this->dispatchInfo = $this->router->match($this->pathInfo);
     }
     return $this->dispatchInfo;
 }
コード例 #3
0
 /**
  * Set router
  *
  * @param Cola_Router $router
  * @return Cola
  */
 public function setRouter($router = null)
 {
     if (null === $router) {
         $router = Cola_Router::getInstance();
     }
     $this->_router = $router;
     return $this;
 }