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.

ContentBlock_Accordion   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 6
dl 0
loc 59
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
B getCMSFields() 0 24 1
A getBlockType() 0 4 1
A AccordionClasses() 0 8 2
1
<?php
2
3
/**
4
 * Models a Content Block Accordion
5
 *
6
 * @since 1.0.0
7
 */
8
class ContentBlock_Accordion extends ContentBlock
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 $db = [
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $db 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
        'AccordionTitle' => 'Text',
13
        'AccordionSummary' => 'Text',
14
        'AccordionContent' => 'HTMLText',
15
    ];
16
17
    public function getCMSFields()
18
    {
19
        $fields = parent::getCMSFields();
20
21
        $fields->push(
22
            TextField::create('AccordionTitle')
23
            ->setDescription('Title line for the Accordion')
24
        );
25
26
        $fields->push(
27
            TextareaField::create('AccordionSummary')
28
            ->setDescription('Custom Summary for the Accordion')
29
        );
30
31
        $fields->push(
32
            HTMLEditorField::create('AccordionContent')
33
            ->setDescription('Content in the accordion')
34
            ->setRows(20)
35
        );
36
37
        $this->extend('updateCMSFields', $fields);
38
39
        return $fields;
40
    }
41
42
    /**
43
     * Gets the block type for CMS display
44
     *
45
     * @return string
46
     */
47
    public function getBlockType()
48
    {
49
        return 'Accordion';
50
    }
51
52
    /**
53
     * Gets the configured classes for a column
54
     *
55
     * @return string
56
     */
57
    public function AccordionClasses()
58
    {
59
        $classesArray = Config::inst()->get('ContentBlock_Accordion', 'accordion_classes');
60
61
        $this->extend('updateAccordionClasses', $classes);
62
63
        return (!empty($classesArray)) ? implode(' ', $classesArray) : '' ;
64
    }
65
66
}
67