| Conditions | 3 |
| Paths | 3 |
| Total Lines | 31 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3.0032 |
| 1 | <?php |
||
| 5 | 2 | public static function parse_gallery_image($arguments, $caption = null, $parser = null) |
|
| 6 | { |
||
| 7 | |||
| 8 | // first things first, if we dont have an ID, then we don't need to |
||
| 9 | // go any further |
||
| 10 | 2 | if (empty($arguments['id'])) { |
|
| 11 | return; |
||
| 12 | } |
||
| 13 | |||
| 14 | 2 | $customise = array(); |
|
| 15 | 2 | $galleryImage = DataObject::get_by_id('GalleryImage', $arguments['id']); |
|
| 16 | 2 | if (!$galleryImage) { |
|
| 17 | 1 | return 'image not found'; |
|
| 18 | } |
||
| 19 | |||
| 20 | 1 | $customise['Image'] = $galleryImage->Image(); |
|
| 21 | 1 | $customise['Aperture'] = $galleryImage->Aperture; |
|
| 22 | 1 | $customise['ShutterSpeed'] = $galleryImage->ShutterSpeed; |
|
| 23 | |||
| 24 | //set the caption |
||
| 25 | 1 | $customise['Title'] = $galleryImage->Title; |
|
| 26 | |||
| 27 | //overide the defaults with the arguments supplied |
||
| 28 | 1 | $customise = array_merge($customise, $arguments); |
|
| 29 | |||
| 30 | //get our YouTube template |
||
| 31 | 1 | $template = new SSViewer('ShortCodeGalleryImage'); |
|
| 32 | |||
| 33 | //return the customised template |
||
| 34 | 1 | return $template->process(new ArrayData($customise)); |
|
| 35 | } |
||
| 36 | } |
||
| 37 |
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.