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

ContentType   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 19
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 2
A __toString() 0 4 1
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\Filesystem\{
8
    MediaType\MediaType,
9
    Exception\InvalidArgumentException
10
};
11
12
/**
13
 * Same behaviour as HTTP Content-Type header
14
 */
15
final class ContentType
16
{
17
    private $value;
18
19 4
    public function __construct(string $topLevel, string $subType)
20
    {
21
        try {
22 4
            $mediaType = new MediaType($topLevel, $subType);
0 ignored issues
show
Unused Code introduced by
$mediaType is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
23 3
            $this->value = $topLevel.'/'.$subType;
24 1
        } catch (InvalidArgumentException $e) {
25 1
            throw new DomainException;
26
        }
27 3
    }
28
29 2
    public function __toString(): string
30
    {
31 2
        return $this->value;
32
    }
33
}
34