if ($prefix !==
$staticPrefix &&
$this->prefix ===
$staticPrefix) { // the new route is non-static and has no static prefix
break;
} continue;
} if ($item instanceof self &&
$this->prefixes
[$i] ===
$commonPrefix) { // the new route is a child of a previous one, let's nest it
$item->
addRoute($prefix,
$route);
} else { // the new route and a previous one have a common prefix, let's merge them
$child =
new self($commonPrefix);
[$child->prefixes
[0
],
$child->staticPrefixes
[0
]] =
$child->
getCommonPrefix($this->prefixes
[$i],
$this->prefixes
[$i]);
[$child->prefixes
[1
],
$child->staticPrefixes
[1
]] =
$child->
getCommonPrefix($prefix,
$prefix);
$child->items =
[$this->items
[$i],
$route];
$this->staticPrefixes
[$i] =
$commonStaticPrefix;
$this->prefixes
[$i] =
$commonPrefix;
$this->items
[$i] =
$child;
}