Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Lines | 10 |
Ratio | 100 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
22 | 13 | public function __construct(MetadataAwareInterface $container, string $name, \Exception $previous = null) |
|
23 | { |
||
24 | 13 | $info = method_exists($container, '__toString') |
|
25 | 13 | ? (string) $container |
|
26 | 13 | : get_class($container); |
|
27 | |||
28 | 13 | $message = sprintf('Attribute "%s" of metadata already exists inside of [%s]. To set new one, the old one must be removed.', $name, $info); |
|
29 | |||
30 | 13 | parent::__construct($message, 0, $previous); |
|
31 | } |
||
32 | } |
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.