public function setRevision(AbstractRevision $revision)
 {
     $this->revision = $revision;
     $content = $revision->getContent();
     $this->content = is_string($content) ? $content : '';
     return $this;
 }
 public function addRevision(AbstractRevision $revision)
 {
     if (!$this->revisions instanceof SplDoublyLinkedList) {
         $this->revisions = new SplDoublyLinkedList();
     }
     if ($revision instanceof MediaWikiRevision) {
         $title = $this->getTitle();
     }
     $revision->setTitle($title);
     // HAS to be TITLE!
     $this->revisions->push($revision);
     return $this;
 }
 /**
  * Apply Wikitext rewrites.
  *
  * @param AbstractRevision $revision Input we want to transfer into Markdown
  *
  * @return AbstractRevision
  */
 public function apply(AbstractRevision $revision)
 {
     if ($revision instanceof MediaWikiRevision) {
         try {
             $content = $this->getPageFromApi($revision->getTitle());
         } catch (Exception $e) {
             $title = $revision->getTitle();
             $url = $this->apiUrl . urlencode($title);
             $message = sprintf('Could not get data from API for %s with the following URI %s', $title, $url);
             throw new Exception($message, 0, $e);
         }
         $front_matter = [];
         $rev_matter = $revision->getFrontMatterData();
         $newRev = new MarkdownRevision($content, array_merge($rev_matter, $front_matter));
         return $newRev->setTitle($revision->getTitle());
     }
     return $revision;
 }
 /**
  * Apply Wikitext rewrites.
  *
  * @param AbstractRevision $revision Input we want to transfer into Markdown
  *
  * @return AbstractRevision
  */
 public function apply(AbstractRevision $revision)
 {
     throw new \Exception('This is a Stub class. Please adapt before using');
     if ($revision instanceof MediaWikiRevision) {
         $content = $this->filter($revision->getContent());
         // Should we make a loop for that?
         $content = preg_replace_callback('/\\[([^\\[\\]\\|\\n\': ]+)\\]/', 'self::helperExternlinks', $content);
         $content = preg_replace_callback('/\\[?\\[([^\\[\\]\\|\\n\' ]+)[\\| ]([^\\]\']+)\\]\\]?/', 'self::helperExternlinks', $content);
         $front_matter = array();
         if (empty(trim($content))) {
             $front_matter['is_stub'] = 'true';
             $content = PHP_EOL;
             // Let’s redefine at only one line instead of using a filter.
         }
         $rev_matter = $revision->getFrontMatterData();
         $newRev = new MarkdownRevision($content, array_merge($rev_matter, $front_matter));
         return $newRev->setTitle($revision->getTitle());
     }
     return $revision;
 }