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
Pull Request — master (#32)
by Tomasz
02:27
created

ReplaceShortcodesEvent::getText()   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 0
Metric Value
c 1
b 0
f 0
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\Event;
3
4
use Thunder\Shortcode\Shortcode\ReplacedShortcode;
5
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
6
7
/**
8
 * This event is called just before returning processed text result at each
9
 * processing level to alter the way shortcodes are replaced with their handlers
10
 * results in the source text.
11
 *
12
 * @author Tomasz Kowalczyk <[email protected]>
13
 */
14
class ReplaceShortcodesEvent
15
{
16
    private $shortcode;
17
    private $text;
18
    /** @var ReplacedShortcode[] */
19
    private $replacements;
20
    private $result;
21
22 36
    public function __construct($text, array $replacements, ShortcodeInterface $shortcode = null)
23
    {
24 36
        $this->shortcode = $shortcode;
25 36
        $this->text = $text;
26 36
        $this->result = null;
27
28 36
        $this->setReplacements($replacements);
29 36
    }
30
31 36
    private function setReplacements(array $replacements)
32
    {
33 36
        foreach($replacements as $replacement) {
34 36
            $this->addReplacement($replacement);
35 36
        }
36 36
    }
37
38 36
    private function addReplacement(ReplacedShortcode $replacement)
39
    {
40 36
        $this->replacements[] = $replacement;
41 36
    }
42
43 1
    public function getText()
44
    {
45 1
        return $this->text;
46
    }
47
48 2
    public function getReplacements()
49
    {
50 2
        return $this->replacements;
51
    }
52
53 1
    public function getShortcode()
54
    {
55 1
        return $this->shortcode;
56
    }
57
58 2
    public function setResult($result)
59
    {
60 2
        $this->result = $result;
61 2
    }
62
63 2
    public function getResult()
64
    {
65 2
        return $this->result;
66
    }
67
68 36
    public function hasResult()
69
    {
70 36
        return null !== $this->result;
71
    }
72
}
73