1 | <?php |
||
20 | class Heading extends AbstractStringContainerBlock implements InlineContainerInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var int |
||
24 | */ |
||
25 | protected $level; |
||
26 | |||
27 | /** |
||
28 | * @param int $level |
||
29 | * @param string|string[] $contents |
||
30 | */ |
||
31 | 159 | public function __construct(int $level, $contents) |
|
32 | { |
||
33 | 159 | parent::__construct(); |
|
34 | |||
35 | 159 | $this->level = $level; |
|
36 | |||
37 | 159 | if (!\is_array($contents)) { |
|
38 | 111 | $contents = [$contents]; |
|
39 | } |
||
40 | |||
41 | 159 | foreach ($contents as $line) { |
|
42 | 159 | $this->addLine($line); |
|
43 | } |
||
44 | 159 | } |
|
45 | |||
46 | /** |
||
47 | * @return int |
||
48 | */ |
||
49 | 150 | public function getLevel(): int |
|
53 | |||
54 | 129 | public function finalize(ContextInterface $context, int $endLineNumber) |
|
60 | |||
61 | /** |
||
62 | * Returns true if this block can contain the given block as a child node |
||
63 | * |
||
64 | * @param AbstractBlock $block |
||
65 | * |
||
66 | * @return bool |
||
67 | */ |
||
68 | 3 | public function canContain(AbstractBlock $block): bool |
|
69 | { |
||
70 | 3 | return false; |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * Whether this is a code block |
||
75 | * |
||
76 | * @return bool |
||
77 | */ |
||
78 | 3 | public function isCode(): bool |
|
79 | { |
||
80 | 3 | return false; |
|
81 | } |
||
82 | |||
83 | 81 | public function matchesNextLine(Cursor $cursor): bool |
|
87 | |||
88 | /** |
||
89 | * @param ContextInterface $context |
||
90 | * @param Cursor $cursor |
||
91 | */ |
||
92 | 129 | public function handleRemainingContents(ContextInterface $context, Cursor $cursor) |
|
96 | } |
||
97 |