Completed
Push — master ( d80399...dcfb5e )
by Askupa
02:14
created

Component_slider::get_template_path()   A

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
        );
30
    }
31
    
32
    public function required_arguments()
33
    {
34
        return array('name','min','max');
35
    }
36
    
37
    public function get_template_path() 
38
    {
39
        return __DIR__.'/template.phtml';
40
    }
41
42
    /**
43
     * This filter is needed when the form is submitted without $.amarkalUIForm.
44
     * When using $.amarkalUIForm to submit the form, the component's getValue/setValue 
45
     * will handle this.
46
     *
47
     * @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...
48
     * @return void
49
     */
50
    public function filter($v)
51
    {
52
        return \floatval($v);
53
    }
54
}