Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Details | Vergleich mit vorheriger | 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
 
991 lars 19
use League\CommonMark\Exception\InvalidArgumentException;
148 lars 20
use League\CommonMark\Node\Node;
21
 
22
/**
23
 * Block-level element
24
 *
25
 * @method parent() ?AbstractBlock
26
 */
27
abstract class AbstractBlock extends Node
28
{
29
    protected ?int $startLine = null;
30
 
31
    protected ?int $endLine = null;
32
 
33
    protected function setParent(?Node $node = null): void
34
    {
35
        if ($node && ! $node instanceof self) {
991 lars 36
            throw new InvalidArgumentException('Parent of block must also be block (cannot be inline)');
148 lars 37
        }
38
 
39
        parent::setParent($node);
40
    }
41
 
42
    public function setStartLine(?int $startLine): void
43
    {
44
        $this->startLine = $startLine;
45
        if ($this->endLine === null) {
46
            $this->endLine = $startLine;
47
        }
48
    }
49
 
50
    public function getStartLine(): ?int
51
    {
52
        return $this->startLine;
53
    }
54
 
55
    public function setEndLine(?int $endLine): void
56
    {
57
        $this->endLine = $endLine;
58
    }
59
 
60
    public function getEndLine(): ?int
61
    {
62
        return $this->endLine;
63
    }
64
}