Completed
Push — master ( c8219e...d46307 )
by Askupa
01:31
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.
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.
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.
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
         );
26 26
     }
27 27
     
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function filter($v)
48 48
     {
49
-        if($v !== 'on') return 'off';
49
+        if ($v !== 'on') return 'off';
50 50
         return 'on';
51 51
     }
52 52
 }
53 53
\ 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.
components/button/controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
     
30 30
     public function required_arguments()
31 31
     {
32
-        return array('request_url','label_start');
32
+        return array('request_url', 'label_start');
33 33
     }
34 34
     
35 35
     public function get_template_path() 
Please login to merge, or discard this patch.
ComponentList.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@
 block discarded – undo
159 159
     /**
160 160
      * Filter the list of components
161 161
      *
162
-     * @param function $callable
162
+     * @param \Closure $callable
163 163
      * @return array
164 164
      */
165 165
     private function filter( $callable )
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      *
20 20
      * @param array $components
21 21
      */
22
-    public function __construct( array $components = array() )
22
+    public function __construct(array $components = array())
23 23
     {
24 24
         $this->add_components($components);
25 25
     }
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
      * @param string $name
31 31
      * @return AbstractComponent
32 32
      */
33
-    public function get_by_name( $name )
33
+    public function get_by_name($name)
34 34
     {
35 35
         $filtered = $this->filter(function($c) use ($name) {
36 36
             return $c instanceof ValueComponentInterface && $c->name === $name;
37 37
         });
38
-        if(count($filtered) < 1)
38
+        if (count($filtered) < 1)
39 39
         {
40 40
             throw new \RuntimeException("No component with the name <b>$name</b> could be found.");
41 41
         }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      * @param string $type
49 49
      * @return AbstractComponent[]
50 50
      */
51
-    public function get_by_type( $type )
51
+    public function get_by_type($type)
52 52
     {
53 53
         return $this->filter(function($c) use ($type) {
54 54
             return $c->component_type === $type;
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
      * @param AbstractComponent[] $components
108 108
      * @return void
109 109
      */
110
-    public function add_components( array $components )
110
+    public function add_components(array $components)
111 111
     {
112
-        foreach( $components as $component )
112
+        foreach ($components as $component)
113 113
         {
114 114
             $this->add_component($component);
115 115
         }
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
      * @param AbstractComponent[] $args
122 122
      * @return void
123 123
      */
124
-    public function add_component( array $args )
124
+    public function add_component(array $args)
125 125
     {
126
-        if(!array_key_exists('type', $args))
126
+        if (!array_key_exists('type', $args))
127 127
         {
128 128
             throw new \RuntimeException("Component configuration arrays must have a <b>type</b> argument");
129 129
         }
@@ -140,16 +140,16 @@  discard block
 block discarded – undo
140 140
      * @param AbstractComponent $comp
141 141
      * @return void
142 142
      */
143
-    private function verify_name_uniqueness( AbstractComponent $comp )
143
+    private function verify_name_uniqueness(AbstractComponent $comp)
144 144
     {
145
-        if(!($comp instanceof ValueComponentInterface))
145
+        if (!($comp instanceof ValueComponentInterface))
146 146
         {
147 147
             return;
148 148
         }
149 149
 
150 150
         foreach ($this->components as $c) 
151 151
         {
152
-            if($c->name === $comp->name)
152
+            if ($c->name === $comp->name)
153 153
             {
154 154
                 throw new \RuntimeException("Duplicate component name detected for the name <b>{$c->name}</b>.");
155 155
             }
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param function $callable
163 163
      * @return array
164 164
      */
165
-    private function filter( $callable )
165
+    private function filter($callable)
166 166
     {
167 167
         // array_values is needed in order to reindex the array after filtering it
168 168
         return array_values(array_filter($this->components, $callable));
Please login to merge, or discard this patch.
components/toggle/controller.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@
 block discarded – undo
8 8
 class Component_toggle
9 9
 extends AbstractComponent
10 10
 implements ValueComponentInterface,
11
-           FilterableComponentInterface,
12
-           DisableableComponentInterface
11
+            FilterableComponentInterface,
12
+            DisableableComponentInterface
13 13
 {
14 14
     public $component_type = 'toggle';
15 15
     
Please login to merge, or discard this 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,13 +33,13 @@  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
         );
38 38
     }
39 39
     
40 40
     public function required_arguments()
41 41
     {
42
-        return array('name','data');
42
+        return array('name', 'data');
43 43
     }
44 44
     
45 45
     public function get_template_path() 
@@ -58,16 +58,16 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function filter($v)
60 60
     {
61
-        if($this->multi && !\is_array($v)) 
61
+        if ($this->multi && !\is_array($v)) 
62 62
         {
63 63
             return \explode(',', $v);
64 64
         }
65 65
         return $v;
66 66
     }
67 67
 
68
-    protected function is_selected( $value )
68
+    protected function is_selected($value)
69 69
     {
70
-        if($this->multi) 
70
+        if ($this->multi) 
71 71
         {
72 72
             return \in_array($value, $this->value);
73 73
         }
Please login to merge, or discard this patch.
components/code/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_code
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 = 'code';
16 16
     
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     
33 33
     public function required_arguments()
34 34
     {
35
-        return array('name','language');
35
+        return array('name', 'language');
36 36
     }
37 37
     
38 38
     public function get_template_path() 
Please login to merge, or discard this patch.