PhpUserAgentParser::parse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
ccs 6
cts 6
cp 1
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Dziki\MonologSentryBundle\UserAgent;
6
7
class PhpUserAgentParser implements ParserInterface
8
{
9 1
    public function parse(string $userAgent): UserAgent
10
    {
11
        [
12 1
            'browser' => $browserName,
13 1
            'version' => $browserVersion,
14 1
            'platform' => $platform,
15
        ]
16 1
            = \parse_user_agent($userAgent);
17
18 1
        return UserAgent::create((string) $browserName, (string) $browserVersion, (string) $platform);
19
    }
20
}
21