/**
  * Absolute path including version and lang folder.
  * 
  * @throws InvalidArgumentException
  *
  * @param bool $defaultFile - If this is a folder and this is set to true then getPath
  *				will return the path of the first file in the folder
  * @return string 
  */
 function getPath($defaultFile = false)
 {
     if ($this->entity) {
         $path = Controller::join_links($this->entity->getPath($this->getVersion(), $this->lang), $this->getRelativePath());
         if (!is_dir($path)) {
             $path = realpath($path);
         } else {
             if ($defaultFile) {
                 $file = DocumentationService::find_page($this->entity, explode('/', $this->getRelativePath()));
                 if ($file) {
                     $path = $file;
                 }
             }
         }
     } else {
         $path = $this->getRelativePath();
     }
     if (!file_exists($path)) {
         throw new InvalidArgumentException(sprintf('Path could not be found. Module path: %s, file path: %s', $this->entity->getPath(), $this->getRelativePath()));
     }
     return is_dir($path) ? rtrim($path, '/') . '/' : $path;
 }
 /**
  * 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);
 }
 /**
  * This should return the link from the entity root to the page. For the url
  * polished version, see {@link getRelativeLink()}.
  *
  * @return string
  */
 public function getRelativePath()
 {
     return str_replace($this->entity->getPath(), '', $this->getPath());
 }
 /**
  *
  * @param DocumentationPage $page
  * @param string $basename
  * @param string $path
  */
 protected function addPage($page, $basename, $path)
 {
     $link = $this->stripLinkBase($page->Link());
     $this->pages[$link] = array('title' => $page->getTitle(), 'basename' => $basename, 'filepath' => $path, 'type' => get_class($page), 'entitypath' => $this->entity->getPath(), 'summary' => $page->getSummary());
 }