Completed
Push — 3.0 ( e1a49c...22c312 )
by Alexander
13:27
created

CircularReferenceException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 4
crap 2
1
<?php
2
/**
3
 * @link http://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license http://www.yiiframework.com/license/
6
 */
7
8
namespace yii\di;
9
10
use yii\base\InvalidConfigException;
11
12
/**
13
 * NotInstantiableException is thrown when container tries to resolve
14
 * object having circular reference in configuration.
15
 *
16
 * @author Andrii Vasyliev <[email protected]>
17
 * @since 3.0.0
18
 */
19
class CircularReferenceException extends InvalidConfigException
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24 2
    public function __construct($class, $message = null, $code = 0, \Exception $previous = null)
25
    {
26 2
        if ($message === null) {
27 2
            $message = "Circular reference in $class.";
28
        }
29 2
        parent::__construct($message, $code, $previous);
30 2
    }
31
32
    /**
33
     * @return string the user-friendly name of this exception
34
     */
35
    public function getName()
36
    {
37
        return 'Circular reference';
38
    }
39
}
40