Passed
Pull Request — 1.x (#334)
by Akihito
02:30
created

Profile   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 6
c 1
b 0
f 1
dl 0
loc 17
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A jsonSerialize() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Resource\SemanticLog\Profile;
6
7
use JsonSerializable;
8
use Override;
9
10
final class Profile implements JsonSerializable
11
{
12
    public function __construct(
13
        public ?XHProfResult $xhprof = null,
14
        public ?XdebugTrace $xdebug = null,
15
        public ?PhpProfile $php = null,
16
    ) {
17
    }
18
19
    /** @return array<string, mixed> */
20
    #[Override]
21
    public function jsonSerialize(): array
22
    {
23
        return [
24
            'xhprof' => $this->xhprof ?? [],
25
            'xdebug' => $this->xdebug ?? [],
26
            'php' => $this->php ?? ['backtrace' => []],
27
        ];
28
    }
29
}
30