Completed
Push — master ( d80399...dcfb5e )
by Askupa
02:14
created
components/number/controller.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@
 block discarded – undo
8 8
 class Component_number
9 9
 extends AbstractComponent
10 10
 implements ValueComponentInterface, 
11
-           DisableableComponentInterface,
12
-           FilterableComponentInterface,
13
-           ValidatableComponentInterface
11
+            DisableableComponentInterface,
12
+            FilterableComponentInterface,
13
+            ValidatableComponentInterface
14 14
 {
15 15
     public $component_type = 'number';
16 16
     
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
             'required'      => false,
28 28
             'readonly'      => false,
29 29
             'default'       => null,
30
-            'filter'        => array( $this, 'filter' ),
31
-            'validation'    => array( $this, 'validation' )
30
+            'filter'        => array($this, 'filter'),
31
+            'validation'    => array($this, 'validation')
32 32
         );
33 33
     }
34 34
     
@@ -37,19 +37,19 @@  discard block
 block discarded – undo
37 37
         return floatval($v);
38 38
     }
39 39
     
40
-    public function validation($v,&$e)
40
+    public function validation($v, &$e)
41 41
     {
42 42
         $max = $this->max;
43 43
         $min = $this->min;
44 44
         
45
-        if(null !== $max && $v > $max)
45
+        if (null !== $max && $v > $max)
46 46
         {
47
-            $e = sprintf( __("Value must be less than %d",'amarkal'), $max);
47
+            $e = sprintf(__("Value must be less than %d", 'amarkal'), $max);
48 48
         }
49 49
 
50
-        if(null !== $min && $v < $min) 
50
+        if (null !== $min && $v < $min) 
51 51
         {
52
-            $e = sprintf( __("Value must be greater than %d",'amarkal'), $min);
52
+            $e = sprintf(__("Value must be greater than %d", 'amarkal'), $min);
53 53
         }
54 54
 
55 55
         return $e ? false : true;
Please login to merge, or discard this patch.
components/text/controller.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@
 block discarded – undo
8 8
 class Component_text
9 9
 extends AbstractComponent
10 10
 implements ValueComponentInterface, 
11
-           DisableableComponentInterface,
12
-           FilterableComponentInterface,
13
-           ValidatableComponentInterface
11
+            DisableableComponentInterface,
12
+            FilterableComponentInterface,
13
+            ValidatableComponentInterface
14 14
 {
15 15
     public $component_type = 'text';
16 16
     
Please login to merge, or discard this patch.
components/radio/controller.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 class Component_radio
9 9
 extends AbstractComponent
10 10
 implements ValueComponentInterface, 
11
-           DisableableComponentInterface
11
+            DisableableComponentInterface
12 12
 {
13 13
     public $component_type = 'radio';
14 14
     
Please login to merge, or discard this patch.
AbstractComponent.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * 
34 34
      * @param array $model
35 35
      */
36
-    public function __construct( array $model = array() ) 
36
+    public function __construct(array $model = array()) 
37 37
     {
38 38
         parent::__construct($model);
39 39
         
@@ -74,24 +74,24 @@  discard block
 block discarded – undo
74 74
      * 
75 75
      * @return array
76 76
      */
77
-    public function set_model( $model )
77
+    public function set_model($model)
78 78
     {
79 79
         // Check that the required arguments are provided.
80
-        foreach( $this->required_arguments() as $key )
80
+        foreach ($this->required_arguments() as $key)
81 81
         {
82
-            if ( !isset($model[$key]) )
82
+            if (!isset($model[$key]))
83 83
             {
84 84
                 throw new \RuntimeException('The required argument "'.$key.'" was not provided for '.get_called_class());
85 85
             }
86 86
         }
87 87
         
88 88
         // Assign the name of the component as the id if no id was specified
89
-        if( !isset($model['id']) )
89
+        if (!isset($model['id']))
90 90
         {
91 91
             $model['id'] = $model['name'];
92 92
         }
93 93
         
94
-        $this->model = array_merge( $this->default_model(), $model );
94
+        $this->model = array_merge($this->default_model(), $model);
95 95
     }
96 96
     
97 97
     /**
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
      * 
111 111
      * @param string $class
112 112
      */
113
-    public function add_html_class( $class )
113
+    public function add_html_class($class)
114 114
     {
115
-        if( !in_array($class, $this->html_classes) )
115
+        if (!in_array($class, $this->html_classes))
116 116
         {
117 117
             $this->html_classes[] = $class;
118 118
         }
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
      * 
125 125
      * @param string $class
126 126
      */
127
-    public function remove_html_class( $class )
127
+    public function remove_html_class($class)
128 128
     {
129 129
         $i = 0;
130
-        foreach( $this->html_classes as $c )
130
+        foreach ($this->html_classes as $c)
131 131
         {
132
-            if( $c === $class )
132
+            if ($c === $class)
133 133
             {
134
-                array_splice($this->html_classes,$i,1);
134
+                array_splice($this->html_classes, $i, 1);
135 135
                 break;
136 136
             }
137 137
             $i++;
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
      * 
144 144
      * @param type $validity
145 145
      */
146
-    Public function set_validity( $validity )
146
+    Public function set_validity($validity)
147 147
     {
148 148
         $this->validity = $validity;
149
-        if($validity === $this::INVALID)
149
+        if ($validity === $this::INVALID)
150 150
         {
151 151
             $this->add_html_class('amarkal-ui-component-error');
152 152
         }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * 
170 170
      * {@inheritdoc}
171 171
      */
172
-    public function render( $echo = false )
172
+    public function render($echo = false)
173 173
     {
174 174
         $this->enqueue_scripts();
175 175
         return parent::render($echo);
Please login to merge, or discard this patch.
components/switch/controller.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
      * handle this.
44 44
      *
45 45
      * @param [string] $v
46
-     * @return void
46
+     * @return string
47 47
      */
48 48
     public function filter($v)
49 49
     {
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
 class Component_switch
9 9
 extends AbstractComponent
10 10
 implements ValueComponentInterface, 
11
-           DisableableComponentInterface,
12
-           FilterableComponentInterface
11
+            DisableableComponentInterface,
12
+            FilterableComponentInterface
13 13
 {
14 14
     public $component_type = 'switch';
15 15
     
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
             'required'      => false,
23 23
             'readonly'      => false,
24 24
             'default'       => null,
25
-            'filter'        => array( $this, 'filter' )
25
+            'filter'        => array($this, 'filter')
26 26
         );
27 27
     }
28 28
     
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function filter($v)
49 49
     {
50
-        if($v !== 'on') return 'off';
50
+        if ($v !== 'on') return 'off';
51 51
         return 'on';
52 52
     }
53 53
 }
54 54
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,9 @@
 block discarded – undo
47 47
      */
48 48
     public function filter($v)
49 49
     {
50
-        if($v !== 'on') return 'off';
50
+        if($v !== 'on') {
51
+            return 'off';
52
+        }
51 53
         return 'on';
52 54
     }
53 55
 }
54 56
\ No newline at end of file
Please login to merge, or discard this patch.
components/slider/controller.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
      * will handle this.
46 46
      *
47 47
      * @param [string] $v
48
-     * @return void
48
+     * @return double
49 49
      */
50 50
     public function filter($v)
51 51
     {
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
 class Component_slider
9 9
 extends AbstractComponent
10 10
 implements ValueComponentInterface, 
11
-           DisableableComponentInterface,
12
-           FilterableComponentInterface
11
+            DisableableComponentInterface,
12
+            FilterableComponentInterface
13 13
 {
14 14
     public $component_type = 'slider';
15 15
     
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@
 block discarded – undo
25 25
             'min'           => null,
26 26
             'max'           => null,
27 27
             'step'          => 1,
28
-            'filter'        => array( $this, 'filter' )
28
+            'filter'        => array($this, 'filter')
29 29
         );
30 30
     }
31 31
     
32 32
     public function required_arguments()
33 33
     {
34
-        return array('name','min','max');
34
+        return array('name', 'min', 'max');
35 35
     }
36 36
     
37 37
     public function get_template_path() 
Please login to merge, or discard this patch.