Пример #1
0
 public function getClass($class = NULL, array $args = array())
 {
     $route = Eden_Route_Class::i();
     if (is_null($class)) {
         return $route;
     }
     return $route->callArray($class, $args);
 }
Пример #2
0
 public static function i()
 {
     $class = __CLASS__;
     if (is_null(self::$_instance)) {
         self::$_instance = new $class();
     }
     return self::$_instance;
 }
Пример #3
0
 /**
  * Routes a method.
  *
  * @param *string the class route name
  * @param *string the method route name
  * @param *string the name of the class to route to
  * @param *string the name of the method to route to
  * @return Eden_Route
  */
 public function route($source, $alias, $class, $method = NULL)
 {
     //argument test
     Eden_Route_Error::i()->argument(1, 'string', 'object', 'null')->argument(2, 'string')->argument(3, 'string', 'object')->argument(4, 'string');
     //argument 4 must be a string
     if (is_object($source)) {
         $source = get_class($source);
     }
     //if the method is not a string
     if (!is_string($method)) {
         $method = $alias;
     }
     $route = Eden_Route_Class::i();
     if (!is_null($source)) {
         $source = $route->getRoute($source);
         $source = strtolower($source);
     }
     if (is_string($class)) {
         $class = $route->getRoute($class);
     }
     $this->_route[$source][strtolower($alias)] = array($class, $method);
     return $this;
 }
Пример #4
0
if(!class_exists('Eden_Route')){class Eden_Route extends Eden_Class{protected static $_instance=NULL;public static function i(){$class=__CLASS__;if(is_null(self::$_instance)){self::$_instance=new $class();}return self::$_instance;}public function getClass($class=NULL,array $args=array()){$route=Eden_Route_Class::i();if(is_null($class)){return $route;}return $route->callArray($class,$args);}public function getFunction($function=NULL,array $args=array()){$route=Eden_Route_Function::i();if(is_null($function)){return $route;}return $route->callArray($function,$args);}public function getMethod($class=NULL,$method=NULL,array $args=array()){$route=Eden_Route_Method::i();if(is_null($class) || is_null($method)){return $route;}return $route->call($class,$method,$args);}}}