コード例 #1
0
 function testgetStableVersion()
 {
     $entity = new DocumentationEntity('docs', '1.0', '../sapphiredocs/tests/docs/', 'My Test');
     $entity->addVersion('1.1', '../sapphiredocs/tests/docs-v2.4/');
     $entity->addVersion('0.0', '../sapphiredocs/tests/docs-v3.0/');
     $this->assertEquals('1.1', $entity->getStableVersion(), 'Automatic version sorting');
     $entity = new DocumentationEntity('docs', '1.0', '../sapphiredocs/tests/docs/', 'My Test');
     $entity->addVersion('1.1.', '../sapphiredocs/tests/docs-v2.4/');
     $entity->setStableVersion('1.0');
     $this->assertEquals('1.0', $entity->getStableVersion(), 'Manual setting');
 }
コード例 #2
0
 /**
  * Parse a file (with a lang and a version).
  *
  * @param String $baselink 
  *
  * @return String
  */
 function getHTML($version, $lang = 'en')
 {
     return DocumentationParser::parse($this, $this->entity->getRelativeLink($version, $lang));
 }
コード例 #3
0
 public function getVersion()
 {
     return $this->entity->getVersion();
 }
コード例 #4
0
 /**
  * Absolute path including version and lang folder.
  * 
  *  @return String 
  */
 function getPath()
 {
     $path = rtrim($this->entity->getPath($this->version, $this->lang), '/') . '/' . $this->getRelativePath();
     return realpath($path);
 }
コード例 #5
0
 /**
  * Returns an integer value based on if a given version is the latest
  * version. Will return -1 for if the version is older, 0 if versions are
  * the same and 1 if the version is greater than.
  *
  * @param string $version
  * @return int
  */
 public function compare(DocumentationEntity $other)
 {
     return version_compare($this->getVersion(), $other->getVersion());
 }
コード例 #6
0
 /**
  * @param DocumentationEntity
  *
  * @return DocumentationEntity
  */
 public function getStableVersion(DocumentationEntity $entity)
 {
     foreach ($this->getEntities() as $check) {
         if ($check->getKey() == $entity->getKey()) {
             if ($check->getLanguage() == $entity->getLanguage()) {
                 if ($check->getIsStable()) {
                     return $check;
                 }
             }
         }
     }
     return $entity;
 }