GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ContentBlockExtension::updateCMSFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 13
nc 1
nop 1
1
<?php
2
3
/**
4
 * Adds Content Block functionality to a page
5
 *
6
 * @since 1.0.0
7
 */
8
class ContentBlockExtension 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...
9
{
10
11
    private static $has_many = [
0 ignored issues
show
Unused Code introduced by
The property $has_many 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...
12
		'ContentBlocks' => 'ContentBlock',
13
	];
14
15
    public function updateCMSFields(FieldList $fields)
16
    {
17
        $types = Config::inst()->get('ContentBlock', 'types');
18
        $fields->addFieldToTab(
19
			'Root.ContentBlocks',
20
			GridField::create(
21
				'ContentBlocks',
22
				'Content Blocks',
23
				$this->owner->getComponents('ContentBlocks'),
24
				GridFieldConfig_RecordEditor::create()
25
				->addComponent(new GridFieldOrderableRows('Sort'))
26
                ->removeComponentsByType('GridFieldAddNewButton')
27
                ->addComponent(GridFieldDropdownAddNewButton::create('ContentBlock', $types)
28
                ->setButtonName('Add Content Block'))
29
			)
30
		);
31
    }
32
}
33