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 (#89)
by Tomasz
01:14
created

RewriteReplacementsEvent::getReplacements()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
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 after gathering shortcode handlers results and just
9
 * before the REPLACE_SHORTCODES event to allow modification of replacements
10
 * before applying them in the source text.
11
 *
12
 * @author Tomasz Kowalczyk <[email protected]>
13
 */
14
final class RewriteReplacementsEvent
15
{
16
    /** @var ReplacedShortcode[] */
17
    private $replacements;
18
    /** @var ReplacedShortcode[] */
19
    private $rewritten = array();
20
    /** @var bool */
21
    private $called = false;
22
23
    /** @param ReplacedShortcode[] $replacements */
24 58
    public function __construct(array $replacements)
25
    {
26 58
        $this->replacements = $replacements;
27 58
    }
28
29
    /** @return ReplacedShortcode[] */
30 1
    public function getReplacements()
31
    {
32 1
        $this->called = true;
33
34 1
        return $this->replacements;
35
    }
36
37
    /** @return void */
38 1
    public function addRewritten(ReplacedShortcode $replacement)
39
    {
40 1
        $this->rewritten[] = $replacement;
41 1
    }
42
43
    /** @return ReplacedShortcode[] */
44 58
    public function getRewritten()
45
    {
46 58
        return $this->called ? $this->rewritten : $this->replacements;
47
    }
48
}
49