Passed
Push — 2.6 ( d150f9 )
by Colin
09:39
created

Bracket::hasNext()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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 <[email protected]>
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\Delimiter;
15
16
use League\CommonMark\Node\Node;
17
18
final class Bracket
19
{
20
    private Node $node;
21
    private ?Bracket $previous;
22
    private bool $hasNext = false;
23
    private int $position;
24
    private bool $image;
25
    private bool $active = true;
26
27 410
    public function __construct(Node $node, ?Bracket $previous, int $position, bool $image)
28
    {
29 410
        $this->node     = $node;
30 410
        $this->previous = $previous;
31 410
        $this->position = $position;
32 410
        $this->image    = $image;
33
    }
34
35 320
    public function getNode(): Node
36
    {
37 320
        return $this->node;
38
    }
39
40 410
    public function getPrevious(): ?Bracket
41
    {
42 410
        return $this->previous;
43
    }
44
45 190
    public function hasNext(): bool
46
    {
47 190
        return $this->hasNext;
48
    }
49
50 390
    public function getPosition(): int
51
    {
52 390
        return $this->position;
53
    }
54
55 390
    public function isImage(): bool
56
    {
57 390
        return $this->image;
58
    }
59
60
    /**
61
     * Only valid in the context of non-images (links)
62
     */
63 348
    public function isActive(): bool
64
    {
65 348
        return $this->active;
66
    }
67
68
    /**
69
     * @internal
70
     */
71 42
    public function setHasNext(bool $hasNext): void
72
    {
73 42
        $this->hasNext = $hasNext;
74
    }
75
76
    /**
77
     * @internal
78
     */
79 20
    public function setActive(bool $active): void
80
    {
81 20
        $this->active = $active;
82
    }
83
}
84