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 — develop ( d40077...e71353 )
by Baptiste
03:40
created

ContentEncoding::__construct()   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
c 0
b 0
f 0
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\AMQP\Model\Basic\Message;
5
6
use Innmind\AMQP\Exception\DomainException;
7
use Innmind\Immutable\Str;
8
9
/**
10
 * Same behaviour as HTTP Content-Encoding header
11
 */
12
final class ContentEncoding
13
{
14
    private $value;
15
16 4
    public function __construct(string $value)
17
    {
18 4
        if (!(new Str($value))->matches('~^[\w\-]+$~')) {
19 1
            throw new DomainException;
20
        }
21
22 3
        $this->value = $value;
23 3
    }
24
25 2
    public function __toString(): string
26
    {
27 2
        return $this->value;
28
    }
29
}
30