Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 14 |
Ratio | 100 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
31 | View Code Duplication | public function extract(Context $context, Value $value, PlainExtractorDefinitionInterface $definition, ExtractorInterface $extractor) |
|
|
|||
32 | { |
||
33 | if ($definition->getNext()) { |
||
34 | // we have a type constraint on raw value here, so regards that we return raw value, |
||
35 | // we will try to extract it just to ensure constrain validity |
||
36 | try { |
||
37 | $extractor->extract($context, $value, $definition->getNext()); |
||
38 | } catch (ExtractorException $e) { |
||
39 | throw new ExtractorException('Raw value constraint failed: ' . $e->getMessage()); |
||
40 | } |
||
41 | } |
||
42 | |||
43 | return $value; |
||
44 | } |
||
45 | } |
||
46 |
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.