Component_checkbox   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 37.14 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 13
loc 35
rs 10
wmc 3
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A required_arguments() 0 4 1
A get_template_path() 0 4 1
A default_model() 13 13 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Amarkal\UI;
4
5
/**
6
 * Implements a Checkbox UI component.
7
 */
8
class Component_checkbox
9
extends AbstractComponent
0 ignored issues
show
Coding Style introduced by
The extends keyword must be on the same line as the class name
Loading history...
10
implements ValueComponentInterface, 
0 ignored issues
show
Coding Style introduced by
The implements keyword must be on the same line as the class name
Loading history...
Coding Style introduced by
The first item in a multi-line implements list must be on the line following the implements keyword
Loading history...
11
           DisableableComponentInterface
0 ignored issues
show
Coding Style introduced by
Expected 4 spaces before interface name; 11 found
Loading history...
12
{
13
    public $name_template = '{{name}}[]';
14
    
15
    public $composite_name_template = '{{parent_name}}[{{name}}][]';
16
    
17
    public $component_type = 'checkbox';
18
    
19 View Code Duplication
    public function default_model() 
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
    {
21
        return array(
22
            'name'          => '',
23
            'id'            => '',
24
            'disabled'      => false,
25
            'required'      => false,
26
            'readonly'      => false,
27
            'data'          => array(),
28
            'default'       => array(),
29
            'show'          => null
30
        );
31
    }
32
    
33
    public function required_arguments()
34
    {
35
        return array('name');
36
    }
37
    
38
    public function get_template_path() 
39
    {
40
        return __DIR__.'/template.phtml';
41
    }
42
}