/**
  * {@inheritdoc}
  */
 public function version(Operation $operation, Result $result, Route $route)
 {
     if (!$operation->hasParameter($this->parameter)) {
         return $operation;
     }
     $version = $operation->getParameter($this->parameter);
     $operation->removeParameter($this->parameter);
     if (!($versions = $version->getType()->getEnum())) {
         $requirements = $route->getRequirements();
         $versions = array($requirements[$this->parameter]);
     }
     $operations = array();
     foreach ($versions as $version) {
         $op = clone $operation;
         $op->setVersion($version);
         $op->setPath(str_replace(sprintf('{%s}', $this->parameter), $version, $op->getPath()));
         $operations[] = $op;
     }
     return count($operations) === 1 ? current($operations) : $operations;
 }