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