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

Trace::__toString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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