Component_slider::required_arguments()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
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
}