Exemplo n.º 1
0
 private function getImageData(Image $image)
 {
     $data = ["src" => $image->getSrc()];
     if (($platform = $image->getPlatform()) !== null) {
         $data["platform"] = $platform;
     }
     if (count($purpose = $image->getPurpose()) > 0) {
         $data["purpose"] = implode(" ", $purpose);
     }
     if (($type = $image->getType()) !== null) {
         $data["type"] = $type;
     }
     if (count($sizes = $image->getSizes()) > 0) {
         $data["sizes"] = implode(" ", array_map(function (array $size) {
             return "{$size[0]}x{$size[1]}";
         }, $sizes));
     }
     return $data;
 }