/** * Adds a page url matcher instance. * * @param IPageUrlMatcher $page_url_matcher Page url matcher. * * @return self * @throws PageUrlMatcherException When page url matcher with same priority is already registered. */ public function add(IPageUrlMatcher $page_url_matcher) { $priority = (string) $page_url_matcher->getPriority(); if (isset($this->matchers[$priority])) { throw new PageUrlMatcherException('The page url matcher with "' . $priority . '" priority is already registered.', PageUrlMatcherException::TYPE_DUPLICATE_PRIORITY); } $this->matchers[$priority] = $page_url_matcher; $this->annotationManager->registry[$page_url_matcher->getAnnotationName()] = $page_url_matcher->getAnnotationClass(); krsort($this->matchers, SORT_NUMERIC); return $this; }