1<?php 2 3/* 4 * This file is part of the league/commonmark package. 5 * 6 * (c) Colin O'Dell <colinodell@gmail.com> 7 * 8 * For the full copyright and license information, please view the LICENSE 9 * file that was distributed with this source code. 10 */ 11 12namespace League\CommonMark\Event; 13 14use League\CommonMark\Block\Element\Document; 15use League\CommonMark\Input\MarkdownInputInterface; 16 17/** 18 * Event dispatched when the document is about to be parsed 19 */ 20final class DocumentPreParsedEvent extends AbstractEvent 21{ 22 /** @var Document */ 23 private $document; 24 25 /** @var MarkdownInputInterface */ 26 private $markdown; 27 28 public function __construct(Document $document, MarkdownInputInterface $markdown) 29 { 30 $this->document = $document; 31 $this->markdown = $markdown; 32 } 33 34 public function getDocument(): Document 35 { 36 return $this->document; 37 } 38 39 public function getMarkdown(): MarkdownInputInterface 40 { 41 return $this->markdown; 42 } 43 44 public function replaceMarkdown(MarkdownInputInterface $markdownInput): void 45 { 46 $this->markdown = $markdownInput; 47 } 48} 49