| Conditions | 3 |
| Paths | 3 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | 18 | public function fromValues( $data ) : DensitiesInterface |
|
| 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 | |||
| 39 | 9 | $php_class = $this->php_densities_class; |
|
| 40 | 9 | return new $php_class( array_values( $data )); |
|
| 41 | } |
||
| 42 | |||
| 44 |