AddImageExtension::getPortletCaption()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
class AddImageExtension extends DataExtension {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
	private static $has_one = array(
0 ignored issues
show
Unused Code introduced by
The property $has_one is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
5
		'MainImage' => 'Image'
6
	);
7
8
9
	/*
10
	Add a Location tab containing the map
11
	*/
12
	public function updateCMSFields(FieldList $fields) {
13
		$fields->addFieldToTab('Root.Image', $uf = new UploadField('MainImage',
14
			_t('PageWithImage.MAIN_IMAGE', 'Main Image')));
15
		$uf->setFolderName('pagewithimage');
16
	}
17
18
19
	public function getPortletTitle() {
20
		return $this->owner->Title;
21
	}
22
23
	public function getPortletImage() {
24
		return $this->owner->MainImage();
25
	}
26
27
	public function getPortletCaption() {
28
		return $this->owner->Title;
29
	}
30
}
31