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 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js) 9 * - (c) John MacFarlane 10 * 11 * For the full copyright and license information, please view the LICENSE 12 * file that was distributed with this source code. 13 */ 14 15namespace League\CommonMark; 16 17use League\CommonMark\Block\Element\AbstractBlock; 18use League\CommonMark\Block\Element\Document; 19use League\CommonMark\Reference\ReferenceParser; 20 21interface ContextInterface 22{ 23 /** 24 * @return Document 25 */ 26 public function getDocument(): Document; 27 28 /** 29 * @return AbstractBlock|null 30 */ 31 public function getTip(): ?AbstractBlock; 32 33 /** 34 * @param AbstractBlock|null $block 35 * 36 * @return void 37 */ 38 public function setTip(?AbstractBlock $block); 39 40 /** 41 * @return int 42 */ 43 public function getLineNumber(): int; 44 45 /** 46 * @return string 47 */ 48 public function getLine(): string; 49 50 /** 51 * Finalize and close any unmatched blocks 52 * 53 * @return UnmatchedBlockCloser 54 */ 55 public function getBlockCloser(): UnmatchedBlockCloser; 56 57 /** 58 * @return AbstractBlock 59 */ 60 public function getContainer(): AbstractBlock; 61 62 /** 63 * @param AbstractBlock $container 64 * 65 * @return void 66 */ 67 public function setContainer(AbstractBlock $container); 68 69 /** 70 * @param AbstractBlock $block 71 * 72 * @return void 73 */ 74 public function addBlock(AbstractBlock $block); 75 76 /** 77 * @param AbstractBlock $replacement 78 * 79 * @return void 80 */ 81 public function replaceContainerBlock(AbstractBlock $replacement); 82 83 /** 84 * @return bool 85 */ 86 public function getBlocksParsed(): bool; 87 88 /** 89 * @param bool $bool 90 * 91 * @return $this 92 */ 93 public function setBlocksParsed(bool $bool); 94 95 /** 96 * @return ReferenceParser 97 */ 98 public function getReferenceParser(): ReferenceParser; 99} 100