FooterTextSiteConfig   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%
Metric Value
wmc 1
lcom 0
cbo 4
dl 0
loc 19
ccs 0
cts 9
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateCMSFields() 0 11 1
1
<?php
2
class FooterTextSiteConfig 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...
3
	static $db = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $db.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
4
		'FooterText' => 'HTMLText',
5
		'ColumnStart' => "Enum('1,2,3,4')",
6
		'ColumnWidth' => "Enum('1,2,3,4')"
7
	);
8
9
	function updateCMSFields(FieldList $fields){
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for updateCMSFields.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
10
		$footerTabName = 'Root.'._t('SiteConfig.FOOTER', 'Footer');
11
		$fields->addFieldToTab($footerTabName, $h1=new HTMLEditorField('FooterText', _t('SiteConfig.FOOTER_TEXT', "Text to display in the footer")));	
0 ignored issues
show
Coding Style introduced by
Expected 1 space before = sign of default value
Loading history...
Coding Style introduced by
Expected 1 space after = sign of default value
Loading history...
Coding Style introduced by
Spaces must be used for alignment; tabs are not allowed
Loading history...
12
		$options1 = singleton('SiteConfig')->dbObject('ColumnStart')->EnumValues();
0 ignored issues
show
Coding Style introduced by
Spaces must be used for alignment; tabs are not allowed
Loading history...
13
		$options2 = singleton('SiteConfig')->dbObject('ColumnWidth')->EnumValues();
0 ignored issues
show
Coding Style introduced by
Spaces must be used for alignment; tabs are not allowed
Loading history...
14
		$columnStartField = new DropdownField('ColumnStart',_t('SiteConfig.FOOTER_TEXT_START_COLUMN','Which column (of four) should the footer text start in',$options1));
0 ignored issues
show
Unused Code introduced by
$columnStartField is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
Coding Style introduced by
Spaces must be used for alignment; tabs are not allowed
Loading history...
15
		$columnWidthField = new DropdownField('ColumnStart',_t('SiteConfig.FOOTER_TEXT_WIDTH_COLUMN','How many, of four columns, should the footer text take up',$options2));
0 ignored issues
show
Unused Code introduced by
$columnWidthField is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
Coding Style introduced by
Spaces must be used for alignment; tabs are not allowed
Loading history...
16
		//$fields->addFieldToTab("Root.Footer", $columnStartField);	
0 ignored issues
show
Coding Style introduced by
Spaces must be used for alignment; tabs are not allowed
Loading history...
17
		//$fields->addFieldToTab("Root.Footer", $h1=new HTMLEditorField('FooterText', _t('SiteConfig.FOOTER_TEXT', "Text to display in the footer")));	
0 ignored issues
show
Coding Style introduced by
Spaces must be used for alignment; tabs are not allowed
Loading history...
18
		$h1->setRows(6);
0 ignored issues
show
Coding Style introduced by
Spaces must be used for alignment; tabs are not allowed
Loading history...
19
	}
0 ignored issues
show
Coding Style introduced by
Spaces must be used for alignment; tabs are not allowed
Loading history...
20
}