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.
Passed
Push — master ( 8846c9...67b391 )
by 12345
39s
created

isValidPlaceholderOrThrowException()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace espend\Behat\PlaceholderExtension\Utils;
5
6
/**
7
 * @author Daniel Espendiller <[email protected]>
8
 */
9
final class PlaceholderUtil
10
{
11
    /**
12
     * @param string $placeholder
13
     * @return bool
14
     */
15 20
    public static function isValidPlaceholder(string $placeholder): bool
16
    {
17
        return
18 20
            isset($placeholder[0]) &&
19 20
            $placeholder[0] == '%' &&
20 20
            $placeholder[strlen($placeholder) - 1] === '%'
21
        ;
22
    }
23
24
    /**
25
     * @param string $placeholder
26
     */
27 16
    public static function isValidPlaceholderOrThrowException(string $placeholder)
28
    {
29 16
        if (!static::isValidPlaceholder($placeholder)) {
30 2
            throw new \RuntimeException(
31 2
                'Invalid placeholder given; please wrap your place with a percent sign %foobar%'
32
            );
33
        }
34 14
    }
35
}
36