/**
  * Generates JSON documentation from provided files.
  *
  * @return void
  */
 public function generate()
 {
     foreach ($this->files as $file) {
         $currentFile = substr(str_replace($this->executionPath, '', $file), 3);
         $isPhp = strrpos($file, '.php') == strlen($file) - strlen('.php');
         if ($isPhp) {
             $fileReflector = new FileReflector($file);
             $parser = new CodeParser($file, $currentFile, $fileReflector);
         } else {
             $content = file_get_contents($file);
             $parser = new MarkdownParser($currentFile, $content);
         }
         $document = $parser->parse();
         $writer = new Writer(json_encode($document), $this->outputPath);
         $writer->write(substr($currentFile, 4));
         $this->types->addType(['id' => $document['id'], 'title' => $document['title'], 'contents' => $document['id'] . '.json']);
     }
 }
 public function write()
 {
     $writer = new Writer(json_encode($this->types), $this->outputPath);
     $writer->write('types.json');
 }