Completed
Push — master ( 4d880d...7abe43 )
by Askupa
03:35
created
AbstractComponent.php 1 patch
Spacing   +16 added lines, -16 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
         
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         include dirname(__FILE__).'/AbstractComponent.phtml';
178 178
         $html = ob_get_clean();
179 179
 
180
-        if( !$echo )
180
+        if (!$echo)
181 181
         {
182 182
             return $html;
183 183
         }
Please login to merge, or discard this patch.