Subversion-Projekte lars-tiefland.laravel_shop

Revision

Zur aktuellen Revision | Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
declare(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
 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
11
 *  - (c) John MacFarlane
12
 *
13
 * For the full copyright and license information, please view the LICENSE
14
 * file that was distributed with this source code.
15
 */
16
 
17
namespace League\CommonMark\Node\Block;
18
 
19
use League\CommonMark\Node\Node;
20
 
21
/**
22
 * Block-level element
23
 *
24
 * @method parent() ?AbstractBlock
25
 */
26
abstract class AbstractBlock extends Node
27
{
28
    protected ?int $startLine = null;
29
 
30
    protected ?int $endLine = null;
31
 
32
    protected function setParent(?Node $node = null): void
33
    {
34
        if ($node && ! $node instanceof self) {
35
            throw new \InvalidArgumentException('Parent of block must also be block (cannot be inline)');
36
        }
37
 
38
        parent::setParent($node);
39
    }
40
 
41
    public function setStartLine(?int $startLine): void
42
    {
43
        $this->startLine = $startLine;
44
        if ($this->endLine === null) {
45
            $this->endLine = $startLine;
46
        }
47
    }
48
 
49
    public function getStartLine(): ?int
50
    {
51
        return $this->startLine;
52
    }
53
 
54
    public function setEndLine(?int $endLine): void
55
    {
56
        $this->endLine = $endLine;
57
    }
58
 
59
    public function getEndLine(): ?int
60
    {
61
        return $this->endLine;
62
    }
63
}