Passed
Push — master ( 37709b...f45e89 )
by Aleksei
06:22 queued 17s
created

RecursiveProxyException::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
eloc 4
c 0
b 0
f 0
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 10
cc 3
nc 4
nop 3
crap 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Core\Exception\Container;
6
7
/**
8
 * Recursion can occur due to improper container configuration or
9
 * an unplanned exit from the scope by the execution thread.
10
 */
11
class RecursiveProxyException extends ContainerException
12
{
13 2
    public function __construct(
14
        public readonly string $alias,
15
        public readonly ?string $bindingScope = null,
16
        public readonly ?array $callingScope = null,
17
    ) {
18 2
        $message = "Recursive proxy detected for `$alias`.";
19 2
        $bindingScope === null or $message .= "\nBinding scope: `$bindingScope`.";
20 2
        $callingScope === null or $message .= "\nCalling scope: `" . \implode('.', $callingScope) . '`.';
21 2
        parent::__construct($message);
22
    }
23
}
24