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 ( d8e85b...9135f5 )
by Tomasz
02:28
created

PlaceholderHandler::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
namespace Thunder\Shortcode\Handler;
3
4
use Thunder\Shortcode\Shortcode\ShortcodeInterface;
5
6
/**
7
 * @author Tomasz Kowalczyk <[email protected]>
8
 */
9
final class PlaceholderHandler
10
{
11
    private $delimiter;
12
13 17
    public function __construct($delimiter = '%')
14
    {
15 17
        $this->delimiter = $delimiter;
16 17
    }
17
18
    /**
19
     * [placeholder value=18]You age is %value%[/placeholder]
20
     *
21
     * @param ShortcodeInterface $shortcode
22
     *
23
     * @return mixed
24
     */
25 2
    public function __invoke(ShortcodeInterface $shortcode)
26
    {
27 2
        $args = $shortcode->getParameters();
28 2
        $delimiter = $this->delimiter;
29
        $keys = array_map(function($key) use($delimiter) { return $delimiter.$key.$delimiter; }, array_keys($args));
30 2
        $values = array_values($args);
31
32 2
        return str_replace($keys, $values, $shortcode->getContent());
33
    }
34
}
35