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.

StringStrategy::determineUserAgent()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Middleware\UserAgent\UserAgentStrategy;
4
5
use ApiClients\Middleware\UserAgent\Options;
6
use ApiClients\Middleware\UserAgent\UserAgentStrategyInterface;
7
use InvalidArgumentException;
8
use Psr\Http\Message\RequestInterface;
9
10
final class StringStrategy implements UserAgentStrategyInterface
11
{
12 3
    public function determineUserAgent(RequestInterface $request, array $options): string
13
    {
14 3
        if (!isset($options[Options::USER_AGENT])) {
15 1
            throw new InvalidArgumentException('Missing user agent option');
16
        }
17
18 2
        return $options[Options::USER_AGENT];
19
    }
20
}
21