Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Lines | 10 |
Ratio | 100 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
31 | 18 | public function fromValues( $data ) : ZonesInterface |
|
32 | { |
||
33 | 18 | if ($data instanceOf \Traversable ) |
|
34 | 6 | $data = iterator_to_array( $data ); |
|
35 | 12 | else if (!is_array($data)) |
|
36 | 9 | throw new FilmToolsInvalidArgumentException("Array or Traversable expected"); |
|
37 | |||
38 | 9 | $php_class = $this->php_zones_class; |
|
39 | 9 | return new $php_class( array_values( $data )); |
|
40 | } |
||
41 | |||
58 |
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.