Passed
Pull Request — master (#817)
by Maxim
06:45
created

Trace   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 8 1
A __construct() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Core\Internal;
6
7
/**
8
 * @internal
9
 */
10
final class Trace implements \Stringable
11
{
12 736
    public function __construct(
13
        public readonly string $alias,
14
        public readonly string $information,
15
        public ?string $context = null
16
    ) {
17 736
        $this->context ??= '-';
18
    }
19
20 410
    public function __toString(): string
21
    {
22 410
        $result = [];
23 410
        $result[] = '- ' . $this->alias;
24 410
        $result[] = '    Info: ' . $this->information;
25 410
        $result[] = '    Context: ' . $this->context;
26
27 410
        return \implode(PHP_EOL, $result);
28
    }
29
}
30