public function __construct(ARouteNode $parent, $value, $identifier, $pattern)
 {
     parent::__construct();
     $this->setParent($parent);
     $this->identifier = $identifier;
     $this->identifierWithPrefix = ':' . $this->identifier;
     $tmp = str_replace(':' . $identifier, '(?<ident>' . $pattern . ')', $value);
     $this->fullPattern = '/^' . $tmp . '$/';
     $this->value = $value;
 }
Exemple #2
0
 /**
  * Set parent for node (update parent children also). Should be called only once in lifetime of node!
  * @param ARouteNode $parent
  * @throws RouterException
  */
 protected function setParent(ARouteNode $parent)
 {
     // only one leaf per node should be allowed. Parent can not be leaf
     if ($parent->isLeaf()) {
         throw new RouterException("Parent can not be leaf");
     } else {
         if ($this->isLeaf() && $parent->hasLeaf()) {
             $message = "Only one leaf per node is allowed";
             throw new RouterException($message);
         }
     }
     $parent->children[] = $this;
 }
 public function __construct(ARouteNode $parent, $defaults)
 {
     parent::__construct();
     $this->setParent($parent);
     $this->defaults = $defaults;
 }
 public function __construct(ARouteNode $parent, $identifier)
 {
     parent::__construct();
     $this->setParent($parent);
     $this->identifier = $identifier;
 }