public function getCondition() { if (!empty($this->queryRequirements) && false === $this->conditionComputed) { $this->setCondition(implode(' and ', $this->queryRequirements)); $this->conditionComputed = true; } return parent::getCondition(); }
/** * {@inheritdoc} */ public function setPath($pattern) { parent::setPath($pattern); if (preg_match('#^(.*/)?(\\w+)\\.(\\w+)$#i', $pattern, $matches)) { $this->setFilePath($matches[1]); $this->setFilename($matches[2]); $this->format($matches[3]); } else { $this->setFilePath($pattern); } return $this; }
public function toSilexCollection() { $xtrColl = $this->flat(); $result = new SilexCollection(); foreach ($xtrColl->getSubroutes() as $route) { foreach ($route->sliceByMethods() as $methodRoute) { $silexRoute = new Route($methodRoute->pattern, $methodRoute->defaults, $methodRoute->assert, [], '', [], explode('|', $methodRoute->method), ''); foreach ($methodRoute->convert as $item => $value) { $silexRoute->convert($item, $value); } $result->add($methodRoute->getBind(), $silexRoute); } } return $result; }
/** * Built in decorator resolver for using * @param Route $route * @param array $expressions * @return mixed */ protected function defaultResolver(Route $route, array $expressions) { $path = $route->getPath(); foreach ($expressions as $expression => $decorator) { if (preg_match($expression, $path)) { return $decorator; } } exit; }