Test Failed
Push — master ( 73c405...d57cd2 )
by Konstantins
03:14
created

CircularReferenceException::createMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 0
cts 9
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 1
crap 2
1
<?php declare(strict_types = 1);
2
3
namespace Venta\Container\Exception;
4
5
use Exception;
6
7
/**
8
 * Class CircularReferenceException
9
 *
10
 * @package Venta\Container\Exception
11
 */
12
class CircularReferenceException extends ContainerException
13
{
14
15
    /**
16
     * @inheritDoc
17
     */
18
    protected function createMessage(Exception $previous = null):string
19
    {
20
        // Adding the last dependency to the reflection path.
21
        $this->addToReferenceChain($this->serviceId());
22
        return sprintf(
23
            'Circular reference detected for "%s", path: "%s".',
24
            $this->serviceId(),
25
            implode(' -> ', $this->referenceChain())
26
        );
27
    }
28
29
}