Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 12 |
Ratio | 100 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
41 | View Code Duplication | public function extract(Context $context, Value $value, PlainExtractorDefinitionInterface $definition, ExtractorInterface $extractor) |
|
|
|||
42 | { |
||
43 | foreach ($this->scalar_extractors as $scalar_extractor) { |
||
44 | try { |
||
45 | return $scalar_extractor->extract($context, $value, $definition, $extractor); |
||
46 | } catch (ExtractorException $e) { |
||
47 | // |
||
48 | } |
||
49 | } |
||
50 | |||
51 | throw new ExtractorException('Value must be of the type scalar or be able to be casted to scalar, ' . $value->typeOf()->value() . ' given'); |
||
52 | } |
||
53 | } |
||
54 |
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.