PhpUserAgentParser   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
cbo 1
dl 0
loc 14
rs 10
c 0
b 0
f 0
ccs 6
cts 6
cp 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 11 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