getSizes() as $size) { foreach (ImageFormat::cases() as $format) { $variants[] = [ 'type' => $type, 'size' => $size, 'format' => $format, 'width' => $size->getWidth($type), ]; } } } return $variants; } public static function getVariantsForType(ImageVariantType $type): array { $variants = []; foreach ($type->getSizes() as $size) { foreach (ImageFormat::cases() as $format) { $variants[] = [ 'type' => $type, 'size' => $size, 'format' => $format, 'width' => $size->getWidth($type), ]; } } return $variants; } }