/** * Determine the Route condition by combining Route annotations with Version annotation. * * @param \ReflectionMethod $method * @param RouteAnnotation $annotation * * @return string */ private function getCondition(\ReflectionMethod $method, RouteAnnotation $annotation) { $condition = $annotation->getCondition(); if (!empty($this->versions)) { $versionCondition = "request.attributes.get('version') == ("; $first = true; foreach ($this->versions as $version) { if (!$first) { $versionCondition .= ' or '; } $versionCondition .= '\'' . $version . '\''; $first = false; } $versionCondition .= ')'; $condition = $condition ? '(' . $condition . ') and ' . $versionCondition : $versionCondition; } return $condition; }
/** * Determine the Route condition by combining Route annotations with Version annotation. * * @param \ReflectionMethod $method * @param RouteAnnotation $annotation * * @return string */ private function getCondition(\ReflectionMethod $method, RouteAnnotation $annotation) { $condition = $annotation->getCondition(); if (null !== $this->version) { $versionCondition = "request.attributes.get('version') == '" . $this->version . "'"; $condition = $condition ? '(' . $condition . ') and ' . $versionCondition : $versionCondition; } return $condition; }