Total Complexity | 5 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
11 | class AnimatedGif |
||
12 | { |
||
13 | /** @var AnimGif */ |
||
14 | protected $animation; |
||
15 | |||
16 | /** |
||
17 | * @param Config $config |
||
18 | * @param State[] $states |
||
19 | * |
||
20 | * @throws \Exception |
||
21 | */ |
||
22 | 9 | protected function __construct(Config $config, array $states) |
|
23 | { |
||
24 | 9 | $images = []; |
|
25 | |||
26 | 9 | foreach ($states as $state) { |
|
27 | 9 | $images[] = Gif::createFromState($config, $state)->get(); |
|
28 | } |
||
29 | |||
30 | 9 | $this->animation = new AnimGif(); |
|
31 | 9 | $this->animation->create($images); |
|
32 | 9 | } |
|
33 | |||
34 | /** |
||
35 | * @param Config $config |
||
36 | * @param State[] $states |
||
37 | * |
||
38 | * @return AnimatedGif |
||
39 | * |
||
40 | * @throws \Exception |
||
41 | */ |
||
42 | 9 | public static function createFromStates(Config $config, array $states) |
|
45 | } |
||
46 | |||
47 | 3 | public function get(): AnimGif |
|
50 | } |
||
51 | |||
52 | 6 | public function save(string $filename) |
|
55 | } |
||
56 | } |
||
57 |