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

ReplacedShortcode::withReplacement()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
namespace Thunder\Shortcode\Shortcode;
3
4
/**
5
 * @author Tomasz Kowalczyk <[email protected]>
6
 */
7
final class ReplacedShortcode extends AbstractShortcode
8
{
9
    /** @var string */
10
    private $replacement;
11
    /** @var string */
12
    private $text;
13
    /** @var int */
14
    private $offset;
15
16
    /** @param string $replacement */
17 58 View Code Duplication
    public function __construct(ParsedShortcodeInterface $shortcode, $replacement)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
    {
19 58
        $this->name = $shortcode->getName();
20 58
        $this->parameters = $shortcode->getParameters();
21 58
        $this->content = $shortcode->getContent();
22 58
        $this->bbCode = $shortcode->getBbCode();
23 58
        $this->text = $shortcode->getText();
24 58
        $this->offset = $shortcode->getOffset();
25
26 58
        $this->replacement = $replacement;
27 58
    }
28
29
    /**
30
     * @param string $replacement
31
     *
32
     * @return self
33
     */
34 1
    public function withReplacement($replacement)
35
    {
36 1
        $base = new Shortcode($this->name, $this->parameters, $this->content, $this->bbCode);
37 1
        $parsed = new ParsedShortcode($base, $this->text, $this->offset);
38
39 1
        return new self($parsed, $replacement);
40
    }
41
42
    /** @return string */
43 58
    public function getReplacement()
44
    {
45 58
        return $this->replacement;
46
    }
47
48
    /** @return string */
49 58
    public function getText()
50
    {
51 58
        return $this->text;
52
    }
53
54
    /** @return int */
55 58
    public function getOffset()
56
    {
57 58
        return $this->offset;
58
    }
59
}
60