Component_slider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 48
rs 10
c 1
b 0
f 0
wmc 4
lcom 0
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A default_model() 0 16 1
A required_arguments() 0 4 1
A get_template_path() 0 4 1
A filter() 0 4 1
1
<?php
2
3
namespace Amarkal\UI;
4
5
/**
6
 * Implements a Slider UI component.
7
 */
8
class Component_slider
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
           FilterableComponentInterface
0 ignored issues
show
Coding Style introduced by
Expected 4 spaces before interface name; 11 found
Loading history...
13
{
14
    public $component_type = 'slider';
15
    
16
    public function default_model() 
17
    {
18
        return array(
19
            'name'          => '',
20
            'id'            => '',
21
            'disabled'      => false,
22
            'required'      => false,
23
            'readonly'      => false,
24
            'default'       => null,
25
            'min'           => null,
26
            'max'           => null,
27
            'step'          => 1,
28
            'filter'        => array( $this, 'filter' ),
29
            'show'          => null
30
        );
31
    }
32
    
33
    public function required_arguments()
34
    {
35
        return array('name','min','max');
36
    }
37
    
38
    public function get_template_path() 
39
    {
40
        return __DIR__.'/template.phtml';
41
    }
42
43
    /**
44
     * This filter is needed when the form is submitted without $.amarkalUIForm.
45
     * When using $.amarkalUIForm to submit the form, the component's getValue/setValue 
46
     * will handle this.
47
     *
48
     * @param [string] $v
0 ignored issues
show
Documentation introduced by
The doc-type [string] could not be parsed: Unknown type name "" at position 0. [(view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
49
     * @return void
50
     */
51
    public function filter($v)
52
    {
53
        return \floatval($v);
54
    }
55
}