Completed
Push — master ( e7a507...5603fd )
by Askupa
01:57
created
AbstractComponent.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * 
39 39
      * @param array $model
40 40
      */
41
-    public function __construct( array $model = array() ) 
41
+    public function __construct(array $model = array()) 
42 42
     {
43 43
         parent::__construct($model);
44 44
         
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             $this->component_type
48 48
         ));
49 49
 
50
-        if($this instanceof DisableableComponentInterface && $this->disabled)
50
+        if ($this instanceof DisableableComponentInterface && $this->disabled)
51 51
         {
52 52
             $this->add_html_class('amarkal-ui-disabled');
53 53
         }
@@ -84,30 +84,30 @@  discard block
 block discarded – undo
84 84
      * 
85 85
      * @return array
86 86
      */
87
-    public function set_model( $model )
87
+    public function set_model($model)
88 88
     {
89 89
         // Check that the required arguments are provided.
90
-        foreach( $this->required_arguments() as $key )
90
+        foreach ($this->required_arguments() as $key)
91 91
         {
92
-            if ( !isset($model[$key]) )
92
+            if (!isset($model[$key]))
93 93
             {
94 94
                 throw new \RuntimeException('The required argument "'.$key.'" was not provided for '.get_called_class());
95 95
             }
96 96
         }
97 97
         
98 98
         // Assign the name of the component as the id if no id was specified
99
-        if( !isset($model['id']) && isset($model['name']) )
99
+        if (!isset($model['id']) && isset($model['name']))
100 100
         {
101 101
             $model['id'] = $model['name'];
102 102
         }
103 103
 
104 104
         // A name must be specified when a component has a visibility condition
105
-        if( isset($model['show']) && !isset($model['name']) )
105
+        if (isset($model['show']) && !isset($model['name']))
106 106
         {
107 107
             throw new \RuntimeException('Components with a visibility condition (a "show" argument) must have a name');
108 108
         }
109 109
         
110
-        $this->model = array_merge( $this->default_model(), $model );
110
+        $this->model = array_merge($this->default_model(), $model);
111 111
     }
112 112
     
113 113
     /**
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
      * 
127 127
      * @param string $class
128 128
      */
129
-    public function add_html_class( $class )
129
+    public function add_html_class($class)
130 130
     {
131
-        if( !in_array($class, $this->html_classes) )
131
+        if (!in_array($class, $this->html_classes))
132 132
         {
133 133
             $this->html_classes[] = $class;
134 134
         }
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
      * 
141 141
      * @param string $class
142 142
      */
143
-    public function remove_html_class( $class )
143
+    public function remove_html_class($class)
144 144
     {
145 145
         $i = 0;
146
-        foreach( $this->html_classes as $c )
146
+        foreach ($this->html_classes as $c)
147 147
         {
148
-            if( $c === $class )
148
+            if ($c === $class)
149 149
             {
150
-                array_splice($this->html_classes,$i,1);
150
+                array_splice($this->html_classes, $i, 1);
151 151
                 break;
152 152
             }
153 153
             $i++;
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
      * 
160 160
      * @param type $validity
161 161
      */
162
-    Public function set_validity( $validity )
162
+    Public function set_validity($validity)
163 163
     {
164 164
         $this->validity = $validity;
165
-        if($validity === $this::INVALID)
165
+        if ($validity === $this::INVALID)
166 166
         {
167 167
             $this->add_html_class('amarkal-ui-component-error');
168 168
         }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      * 
186 186
      * {@inheritdoc}
187 187
      */
188
-    public function render( $echo = false )
188
+    public function render($echo = false)
189 189
     {
190 190
         $this->enqueue_scripts();
191 191
         
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         include dirname(__FILE__).'/AbstractComponent.phtml';
194 194
         $html = ob_get_clean();
195 195
 
196
-        if( !$echo )
196
+        if (!$echo)
197 197
         {
198 198
             return $html;
199 199
         }
Please login to merge, or discard this patch.
components/switch/controller.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
             'disabled'      => false,
22 22
             'readonly'      => false,
23 23
             'default'       => null,
24
-            'filter'        => array( $this, 'filter' ),
24
+            'filter'        => array($this, 'filter'),
25 25
             'show'          => null
26 26
         );
27 27
     }
@@ -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.
components/toggle/controller.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     
16 16
     protected function on_created() 
17 17
     {
18
-        if($this->multi && !\is_array($this->default)
18
+        if ($this->multi && !\is_array($this->default)
19 19
         || !$this->multi && \is_array($this->default))
20 20
         {
21 21
             throw new \RuntimeException("The default value must be an array if multi is set to true, and must be a string otherwise.");
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
             'multi'         => false,
34 34
             'data'          => array(),
35 35
             'default'       => array(),
36
-            'filter'        => array( $this, 'filter' ),
36
+            'filter'        => array($this, 'filter'),
37 37
             'show'          => null
38 38
         );
39 39
     }
40 40
     
41 41
     public function required_arguments()
42 42
     {
43
-        return array('name','data');
43
+        return array('name', 'data');
44 44
     }
45 45
     
46 46
     public function get_template_path() 
@@ -59,16 +59,16 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function filter($v)
61 61
     {
62
-        if($this->multi && !\is_array($v)) 
62
+        if ($this->multi && !\is_array($v)) 
63 63
         {
64 64
             return \explode(',', $v);
65 65
         }
66 66
         return $v;
67 67
     }
68 68
 
69
-    protected function is_selected( $value )
69
+    protected function is_selected($value)
70 70
     {
71
-        if($this->multi) 
71
+        if ($this->multi) 
72 72
         {
73 73
             return \in_array($value, $this->value);
74 74
         }
Please login to merge, or discard this patch.
components/slider/controller.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,14 +25,14 @@
 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
             'show'          => null
30 30
         );
31 31
     }
32 32
     
33 33
     public function required_arguments()
34 34
     {
35
-        return array('name','min','max');
35
+        return array('name', 'min', 'max');
36 36
     }
37 37
     
38 38
     public function get_template_path() 
Please login to merge, or discard this patch.
components/number/controller.php 1 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
             'show'          => null
33 33
         );
34 34
     }
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
         return floatval($v);
39 39
     }
40 40
     
41
-    public function validation($v,&$e)
41
+    public function validation($v, &$e)
42 42
     {
43 43
         $max = $this->max;
44 44
         $min = $this->min;
45 45
         
46
-        if(null !== $max && $v > $max)
46
+        if (null !== $max && $v > $max)
47 47
         {
48
-            $e = sprintf( __("Value must be less than %d",'amarkal'), $max);
48
+            $e = sprintf(__("Value must be less than %d", 'amarkal'), $max);
49 49
         }
50 50
 
51
-        if(null !== $min && $v < $min) 
51
+        if (null !== $min && $v < $min) 
52 52
         {
53
-            $e = sprintf( __("Value must be greater than %d",'amarkal'), $min);
53
+            $e = sprintf(__("Value must be greater than %d", 'amarkal'), $min);
54 54
         }
55 55
 
56 56
         return $e ? false : true;
Please login to merge, or discard this patch.