1 | <?php |
||
20 | class ListBlock extends AbstractBlock |
||
21 | { |
||
22 | const TYPE_UNORDERED = 'Bullet'; |
||
23 | const TYPE_ORDERED = 'Ordered'; |
||
24 | |||
25 | /** |
||
26 | * @var bool |
||
27 | */ |
||
28 | protected $tight = false; |
||
29 | |||
30 | /** |
||
31 | * @var ListData |
||
32 | */ |
||
33 | protected $listData; |
||
34 | |||
35 | 255 | public function __construct(ListData $listData) |
|
41 | |||
42 | /** |
||
43 | * @return ListData |
||
44 | */ |
||
45 | 255 | public function getListData(): ListData |
|
49 | |||
50 | /** |
||
51 | * @return bool |
||
52 | */ |
||
53 | 30 | public function endsWithBlankLine(): bool |
|
54 | { |
||
55 | 30 | if ($this->lastLineBlank) { |
|
56 | 3 | return true; |
|
57 | } |
||
58 | |||
59 | 30 | if ($this->hasChildren()) { |
|
60 | 30 | return $this->lastChild() instanceof AbstractBlock && $this->lastChild()->endsWithBlankLine(); |
|
61 | } |
||
62 | |||
63 | return false; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * Returns true if this block can contain the given block as a child node |
||
68 | * |
||
69 | * @param AbstractBlock $block |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | 237 | public function canContain(AbstractBlock $block): bool |
|
77 | |||
78 | /** |
||
79 | * Returns true if block type can accept lines of text |
||
80 | * |
||
81 | * @return bool |
||
82 | */ |
||
83 | 21 | public function acceptsLines(): bool |
|
87 | |||
88 | /** |
||
89 | * Whether this is a code block |
||
90 | * |
||
91 | * @return bool |
||
92 | */ |
||
93 | 123 | public function isCode(): bool |
|
97 | |||
98 | 204 | public function matchesNextLine(Cursor $cursor): bool |
|
102 | |||
103 | 237 | public function finalize(ContextInterface $context, int $endLineNumber) |
|
130 | |||
131 | /** |
||
132 | * @return bool |
||
133 | */ |
||
134 | 255 | public function isTight(): bool |
|
138 | |||
139 | /** |
||
140 | * @param bool $tight |
||
141 | * |
||
142 | * @return $this |
||
143 | */ |
||
144 | public function setTight(bool $tight): self |
||
150 | } |
||
151 |