Ejemplo n.º 1
0
 /**
  * Returns the version which was provided by the user agent. If no version
  * was specified the latest version is used
  *
  * @param \PSX\Api\DocumentationInterface $doc
  * @return \PSX\Api\Version
  */
 protected function getVersion(DocumentationInterface $doc)
 {
     if ($doc->isVersionRequired()) {
         $version = $this->getSubmittedVersionNumber();
         if ($version !== null) {
             return new Version((int) $version);
         } else {
             // it is strongly recommended that clients specify an explicit
             // version but forcing that with an exception is not a good user
             // experience therefore we use the latest version if nothing is
             // specified
             return new Version($doc->getLatestVersion());
             //throw new StatusCode\UnsupportedMediaTypeException('Requires an Accept header containing an explicit version');
         }
     } else {
         return new Version(1);
     }
 }