Passed
Push — master ( 2c1367...72194f )
by Alexey
03:21
created

CircularReferenceException::createMessage()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1.037

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 9
cp 0.6667
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 1
crap 1.037
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 3
    protected function createMessage(Exception $previous = null):string
19
    {
20
        // Adding the last dependency to the reflection path.
21 3
        $this->addToReferenceChain($this->serviceId());
22 3
        return sprintf(
23 3
            'Circular reference detected for "%s", path: "%s".',
24 3
            $this->serviceId(),
25 3
            implode(' -> ', $this->referenceChain())
26
        );
27
    }
28
29
}