Subversion-Projekte lars-tiefland.laravel_shop

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
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
 
14
namespace League\CommonMark\Parser\Block;
15
 
16
use League\CommonMark\Parser\Cursor;
17
use League\CommonMark\Parser\CursorState;
18
 
19
/**
20
 * Result object for continuing parsing of a block; see static methods for constructors.
21
 *
22
 * @psalm-immutable
23
 */
24
final class BlockContinue
25
{
26
    /** @psalm-readonly */
27
    private ?CursorState $cursorState = null;
28
 
29
    /** @psalm-readonly */
30
    private bool $finalize;
31
 
32
    private function __construct(?CursorState $cursorState = null, bool $finalize = false)
33
    {
34
        $this->cursorState = $cursorState;
35
        $this->finalize    = $finalize;
36
    }
37
 
38
    public function getCursorState(): ?CursorState
39
    {
40
        return $this->cursorState;
41
    }
42
 
43
    public function isFinalize(): bool
44
    {
45
        return $this->finalize;
46
    }
47
 
48
    /**
49
     * Signal that we cannot continue here
50
     *
51
     * @return null
52
     */
53
    public static function none(): ?self
54
    {
55
        return null;
56
    }
57
 
58
    /**
59
     * Signal that we're continuing at the given position
60
     */
61
    public static function at(Cursor $cursor): self
62
    {
63
        return new self($cursor->saveState(), false);
64
    }
65
 
66
    /**
67
     * Signal that we want to finalize and close the block
68
     */
69
    public static function finished(): self
70
    {
71
        return new self(null, true);
72
    }
73
}