@@ -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,30 +84,30 @@ 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 | 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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |