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   A

Complexity

Total Complexity 17

Size/Duplication

Total Lines 126
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 18
Bugs 6 Features 10
Metric Value
wmc 17
c 18
b 6
f 10
lcom 1
cbo 3
dl 0
loc 126
ccs 53
cts 53
cp 1
rs 10

15 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
B createFromContext() 0 29 1
A withContent() 0 7 1
A hasAncestor() 0 12 3
A getParent() 0 4 1
A getTextContent() 0 4 1
A getPosition() 0 4 1
A getNamePosition() 0 4 1
A getText() 0 4 1
A getShortcodeText() 0 4 1
A getOffset() 0 4 1
A getBaseOffset() 0 4 1
A getIterationNumber() 0 4 1
A getRecursionLevel() 0 4 1
A getProcessor() 0 4 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