Пример #1
0
 /**
  *
  * find and replace parameters
  *
  * @return bool
  */
 private function replaceParameters()
 {
     if (preg_match($this->regexSchema, $this->getMatchUrl())) {
         preg_replace_callback($this->getRegexSchema(), [$this, 'resolvePregCallback'], $this->getMatchUrl());
         $resolve = $this->resolveParameters($this->getParameters());
         // something went wrong!
         if (false === $resolve) {
             return false;
         }
         ParameterBag::setParameters($this->getParameters());
     } elseif ($this->getMatchUrl() !== $this->getRequestedUrl()) {
         return false;
     }
     return true;
 }
Пример #2
0
 /**
  *Regex kontrolu yapar
  *
  * @param string|null $url
  * @return bool
  */
 public function match($url = null)
 {
     $match = parent::match($url);
     $regex = $this->getRegex($this->getMatchUrl());
     if ($regex !== ' ') {
         if (preg_match("@" . ltrim($regex) . "@si", $this->getRequestedUrl(), $matches) || true === $match) {
             unset($matches[0]);
             ParameterBag::setParameters($matches);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }