@@ 4-27 (lines=24) @@ | ||
1 | <?php |
|
2 | namespace FilmTools\ExposureSeries; |
|
3 | ||
4 | trait DensitiesAwareTrait |
|
5 | { |
|
6 | use DensitiesProviderTrait; |
|
7 | ||
8 | ||
9 | /** |
|
10 | * @param array|Traversable $densities |
|
11 | * @return self |
|
12 | */ |
|
13 | public function setDensities($densities) |
|
14 | { |
|
15 | if ($densities instanceOf DensitiesProviderInterface): |
|
16 | $densities = $densities->getDensities(); |
|
17 | elseif ($densities instanceOf \Traversable) : |
|
18 | $densities = iterator_to_array($densities); |
|
19 | elseif (!is_array($densities)): |
|
20 | throw new \InvalidArgumentException("Traversable or array expected.", 1); |
|
21 | endif; |
|
22 | ||
23 | $this->densities = $densities; |
|
24 | return $this; |
|
25 | } |
|
26 | ||
27 | } |
|
28 |
@@ 4-27 (lines=24) @@ | ||
1 | <?php |
|
2 | namespace FilmTools\ExposureSeries; |
|
3 | ||
4 | trait ZonesAwareTrait |
|
5 | { |
|
6 | use ZonesProviderTrait; |
|
7 | ||
8 | ||
9 | /** |
|
10 | * @param array|Traversable $zones |
|
11 | * @return self |
|
12 | */ |
|
13 | public function setZones($zones) |
|
14 | { |
|
15 | if ($zones instanceOf ZonesProviderInterface): |
|
16 | $zones = $zones->getZones(); |
|
17 | elseif ($zones instanceOf \Traversable) : |
|
18 | $zones = iterator_to_array($zones); |
|
19 | elseif (!is_array($zones)): |
|
20 | throw new \InvalidArgumentException("Traversable or array expected.", 1); |
|
21 | endif; |
|
22 | ||
23 | $this->zones = $zones; |
|
24 | return $this; |
|
25 | } |
|
26 | ||
27 | } |
|
28 |