This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
14
{
15
/**
16
* Name of not found link
17
*
18
* @var string
19
*/
20
protected $name;
21
22
/**
23
* Container inside of which a link has not been found
24
*
25
* @var LinksAwareInterface
26
*/
27
protected $container;
28
29
/**
30
* LinkNotFoundException constructor.
31
*
32
* @param LinksAwareInterface $container
33
* @param string $name
34
* @param \Exception | null $previous
35
*/
36
10
public function __construct(LinksAwareInterface $container, string $name, \Exception $previous = null)
37
{
38
10
$this->name = $name;
39
10
$this->container = $container;
40
41
10
$info = method_exists($container, '__toString')
42
9
? (string) $container
43
10
: get_class($container);
44
45
10
$message = sprintf('Link "%s" not found inside of [%s].', $name, $info);
46
47
10
parent::__construct($message, 0, $previous);
48
10
}
49
50
/**
51
* Get name of not found link
52
*
53
* @return string
54
*/
55
1
public function getName(): string
56
{
57
1
return $this->name;
58
}
59
60
/**
61
* Get container inside of which a link has not been found
62
*
63
* @return LinksAwareInterface
64
*/
65
1
public function getContainer(): LinksAwareInterface
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.