| Conditions | 7 |
| Paths | 12 |
| Total Lines | 37 |
| Code Lines | 29 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Generate an image gallery from the Gallery template, if no images are |
||
| 32 | * available, then return an empty string. |
||
| 33 | * |
||
| 34 | * @return string |
||
| 35 | */ |
||
| 36 | public function Gallery() |
||
| 37 | { |
||
| 38 | if ($this->Images()->exists()) { |
||
| 39 | |||
| 40 | // Create a list of images with generated gallery image and thumbnail |
||
| 41 | $images = ArrayList::create(); |
||
| 42 | foreach ($this->PaginatedImages() as $image) { |
||
| 43 | $image_data = $image->toMap(); |
||
| 44 | $image_data["GalleryImage"] = $this->GalleryImage($image); |
||
| 45 | $image_data["GalleryThumbnail"] = $this->GalleryThumbnail($image); |
||
| 46 | $images->add(ArrayData::create($image_data)); |
||
| 47 | } |
||
| 48 | |||
| 49 | $vars = array( |
||
| 50 | 'Images' => $images, |
||
| 51 | 'Width' => $this->ImageWidth, |
||
| 52 | 'Height' => $this->ImageHeight |
||
| 53 | ); |
||
| 54 | |||
| 55 | return $this->renderWith('Gallery',$vars); |
||
| 56 | } else { |
||
| 57 | return ""; |
||
| 58 | } |
||
| 59 | } |
||
| 60 | } |
||
| 61 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.