@@ -38,7 +38,7 @@ discard block |
||
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 |
||
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,24 +84,24 @@ discard block |
||
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 | - $this->model = array_merge( $this->default_model(), $model ); |
|
104 | + $this->model = array_merge($this->default_model(), $model); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @param string $class |
122 | 122 | */ |
123 | - public function add_html_class( $class ) |
|
123 | + public function add_html_class($class) |
|
124 | 124 | { |
125 | - if( !in_array($class, $this->html_classes) ) |
|
125 | + if (!in_array($class, $this->html_classes)) |
|
126 | 126 | { |
127 | 127 | $this->html_classes[] = $class; |
128 | 128 | } |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @param string $class |
136 | 136 | */ |
137 | - public function remove_html_class( $class ) |
|
137 | + public function remove_html_class($class) |
|
138 | 138 | { |
139 | 139 | $i = 0; |
140 | - foreach( $this->html_classes as $c ) |
|
140 | + foreach ($this->html_classes as $c) |
|
141 | 141 | { |
142 | - if( $c === $class ) |
|
142 | + if ($c === $class) |
|
143 | 143 | { |
144 | - array_splice($this->html_classes,$i,1); |
|
144 | + array_splice($this->html_classes, $i, 1); |
|
145 | 145 | break; |
146 | 146 | } |
147 | 147 | $i++; |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | * |
154 | 154 | * @param type $validity |
155 | 155 | */ |
156 | - Public function set_validity( $validity ) |
|
156 | + Public function set_validity($validity) |
|
157 | 157 | { |
158 | 158 | $this->validity = $validity; |
159 | - if($validity === $this::INVALID) |
|
159 | + if ($validity === $this::INVALID) |
|
160 | 160 | { |
161 | 161 | $this->add_html_class('amarkal-ui-component-error'); |
162 | 162 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | * |
180 | 180 | * {@inheritdoc} |
181 | 181 | */ |
182 | - public function render( $echo = false ) |
|
182 | + public function render($echo = false) |
|
183 | 183 | { |
184 | 184 | $this->enqueue_scripts(); |
185 | 185 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | include dirname(__FILE__).'/AbstractComponent.phtml'; |
188 | 188 | $html = ob_get_clean(); |
189 | 189 | |
190 | - if( !$echo ) |
|
190 | + if (!$echo) |
|
191 | 191 | { |
192 | 192 | return $html; |
193 | 193 | } |