Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
31 | public function detect(): ?Generator |
||
32 | { |
||
33 | $response = $this->getOriginalResponse(); |
||
34 | |||
35 | if (! $response) { |
||
36 | return null; |
||
37 | } |
||
38 | |||
39 | /** @var ColorInfo $colorInfo */ |
||
40 | foreach ($response->getDominantColors()->getColors() as $colorInfo) { |
||
41 | /** @var Color $color */ |
||
42 | $color = $colorInfo->getColor(); |
||
43 | yield new ImagePropertiesData( |
||
44 | pixelFraction: $colorInfo->getPixelFraction(), |
||
45 | red: $color->getRed(), |
||
46 | green: $color->getGreen(), |
||
47 | blue: $color->getBlue(), |
||
48 | ); |
||
52 |