DNSQueryProfiled::getProfile()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace RemotelyLiving\PHPDNS\Observability\Events;
4
5
use RemotelyLiving\PHPDNS\Observability\Performance\Interfaces\ProfileInterface;
6
use RemotelyLiving\PHPDNS\Observability\Performance\Profile;
7
8
final class DNSQueryProfiled extends ObservableEventAbstract
9
{
10
    public const NAME = 'dns.query.profiled';
11
12
    public function __construct(private ProfileInterface $profile)
13
    {
14
        parent::__construct();
15
    }
16
17
    public function getProfile(): ProfileInterface
18
    {
19
        return $this->profile;
20
    }
21
22
    public static function getName(): string
23
    {
24
        return self::NAME;
25
    }
26
27
    public function toArray(): array
28
    {
29
        return [
30
            'elapsedSeconds' => $this->profile->getElapsedSeconds(),
31
            'transactionName' => $this->profile->getTransactionName(),
32
            'peakMemoryUsage' => $this->profile->getPeakMemoryUsage(),
33
        ];
34
    }
35
}
36