Conditions | 4 |
Paths | 3 |
Total Lines | 13 |
Lines | 13 |
Ratio | 100 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
22 | View Code Duplication | public function __construct($classOrObjectFactory, JmsMetadataParser $metadataParser) |
|
|
|||
23 | { |
||
24 | if (is_object($classOrObjectFactory) && $classOrObjectFactory instanceof ObjectFactoryInterface) { |
||
25 | $objectFactory = $classOrObjectFactory; |
||
26 | } elseif (is_string($classOrObjectFactory)) { |
||
27 | $objectFactory = new DefaultObjectFactory($classOrObjectFactory); |
||
28 | } else { |
||
29 | throw new \InvalidArgumentException('classOrObjectFactory must be of type string or ObjectFactoryInterface'); |
||
30 | } |
||
31 | |||
32 | $this->objectFactory = $objectFactory; |
||
33 | $this->metadataParser = $metadataParser; |
||
34 | } |
||
35 | |||
81 |
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.