GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( c87b3e...4d176b )
by Tomasz
02:18
created

ProcessedShortcode::getBaseOffset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Thunder\Shortcode\Shortcode;
3
4
use Thunder\Shortcode\Processor\ProcessorContext;
5
use Thunder\Shortcode\Processor\ProcessorInterface;
6
7
/**
8
 * @author Tomasz Kowalczyk <[email protected]>
9
 */
10
final class ProcessedShortcode extends AbstractShortcode implements ParsedShortcodeInterface
11
{
12
    /** @var ShortcodeInterface */
13
    private $parent;
14
    private $position;
15
    private $namePosition;
16
    private $text;
17
    private $textContent;
18
    private $offset;
19
    private $baseOffset;
20
    private $shortcodeText;
21
    private $iterationNumber;
22
    private $recursionLevel;
23
    /** @var ProcessorInterface */
24
    private $processor;
25
26 57
    private function __construct()
27
    {
28 57
    }
29
30 57
    public static function createFromContext(ProcessorContext $context)
31
    {
32 57
        $self = new self();
33
34
        // basic properties
35 57
        $self->name = $context->shortcode->getName();
36 57
        $self->parameters = $context->shortcode->getParameters();
37 57
        $self->content = $context->shortcode->getContent();
38 57
        $self->bbCode = $context->shortcode->getBbCode();
39 57
        $self->textContent = $context->textContent;
40
41
        // runtime context
42 57
        $self->parent = $context->parent;
43 57
        $self->position = $context->position;
44 57
        $self->namePosition = $context->namePosition[$self->name];
45 57
        $self->text = $context->text;
46 57
        $self->shortcodeText = $context->shortcodeText;
47
48
        // processor state
49 57
        $self->iterationNumber = $context->iterationNumber;
50 57
        $self->recursionLevel = $context->recursionLevel;
51 57
        $self->processor = $context->processor;
52
53
        // text context
54 57
        $self->offset = $context->offset;
55 57
        $self->baseOffset = $context->baseOffset;
56
57 57
        return $self;
58
    }
59
60 55
    public function withContent($content)
61
    {
62 55
        $self = clone $this;
63 55
        $self->content = $content;
64
65 55
        return $self;
66
    }
67
68 1
    public function hasAncestor($name)
69
    {
70 1
        $self = $this;
71
72 1
        while($self = $self->getParent()) {
73 1
            if($self->getName() === $name) {
74 1
                return true;
75
            }
76 1
        }
77
78 1
        return false;
79
    }
80
81 4
    public function getParent()
82
    {
83 4
        return $this->parent;
84
    }
85
86 3
    public function getTextContent()
87
    {
88 3
        return $this->textContent;
89
    }
90
91 2
    public function getPosition()
92
    {
93 2
        return $this->position;
94
    }
95
96 2
    public function getNamePosition()
97
    {
98 2
        return $this->namePosition;
99
    }
100
101 1
    public function getText()
102
    {
103 1
        return $this->text;
104
    }
105
106 17
    public function getShortcodeText()
107
    {
108 17
        return $this->shortcodeText;
109
    }
110
111 17
    public function getOffset()
112
    {
113 17
        return $this->offset;
114
    }
115
116 1
    public function getBaseOffset()
117
    {
118 1
        return $this->baseOffset;
119
    }
120
121 1
    public function getIterationNumber()
122
    {
123 1
        return $this->iterationNumber;
124
    }
125
126 1
    public function getRecursionLevel()
127
    {
128 1
        return $this->recursionLevel;
129
    }
130
131 1
    public function getProcessor()
132
    {
133 1
        return $this->processor;
134
    }
135
}
136