Completed
Push — master ( 80e027...da7bd7 )
by Jean-Christophe
04:34
created
Ajax/semantic/widgets/datatable/DataTable.php 2 patches
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  *
24 24
  */
25 25
 class DataTable extends Widget {
26
-	use TableTrait,DataTableFieldAsTrait,HasCheckboxesTrait;
26
+	use TableTrait, DataTableFieldAsTrait, HasCheckboxesTrait;
27 27
 	protected $_searchField;
28 28
 	protected $_urls;
29 29
 	protected $_pagination;
@@ -39,35 +39,35 @@  discard block
 block discarded – undo
39 39
 	protected $_sortable;
40 40
 
41 41
 
42
-	public function __construct($identifier,$model,$modelInstance=NULL) {
43
-		parent::__construct($identifier, $model,$modelInstance);
44
-		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0,0), false);
42
+	public function __construct($identifier, $model, $modelInstance=NULL) {
43
+		parent::__construct($identifier, $model, $modelInstance);
44
+		$this->_init(new InstanceViewer($identifier), "table", new HtmlTable($identifier, 0, 0), false);
45 45
 		$this->_urls=[];
46
-		$this->_emptyMessage=new HtmlMessage("","nothing to display");
46
+		$this->_emptyMessage=new HtmlMessage("", "nothing to display");
47 47
 		$this->_emptyMessage->setIcon("info circle");
48 48
 	}
49 49
 
50
-	public function run(JsUtils $js){
51
-		if($this->_hasCheckboxes && isset($js)){
50
+	public function run(JsUtils $js) {
51
+		if ($this->_hasCheckboxes && isset($js)) {
52 52
 			$this->_runCheckboxes($js);
53 53
 		}
54
-		if($this->_visibleHover){
55
-			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
56
-			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
54
+		if ($this->_visibleHover) {
55
+			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');", ["preventDefault"=>false, "stopPropagation"=>true]);
56
+			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');", ["preventDefault"=>false, "stopPropagation"=>true]);
57 57
 		}
58
-		if(\is_array($this->_deleteBehavior))
59
-			$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
60
-		if(\is_array($this->_editBehavior))
61
-			$this->_generateBehavior("edit",$this->_editBehavior,$js);
58
+		if (\is_array($this->_deleteBehavior))
59
+			$this->_generateBehavior("delete", $this->_deleteBehavior, $js);
60
+		if (\is_array($this->_editBehavior))
61
+			$this->_generateBehavior("edit", $this->_editBehavior, $js);
62 62
 		return parent::run($js);
63 63
 	}
64 64
 
65 65
 
66 66
 
67
-	protected function _generateBehavior($op,$params,JsUtils $js){
68
-		if(isset($this->_urls[$op])){
69
-			$params=\array_merge($params,["attr"=>"data-ajax"]);
70
-			$js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op],$this->getTargetSelector(),$params);
67
+	protected function _generateBehavior($op, $params, JsUtils $js) {
68
+		if (isset($this->_urls[$op])) {
69
+			$params=\array_merge($params, ["attr"=>"data-ajax"]);
70
+			$js->getOnClick("#".$this->identifier." ._".$op, $this->_urls[$op], $this->getTargetSelector(), $params);
71 71
 		}
72 72
 	}
73 73
 
@@ -80,134 +80,134 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 
83
-	public function compile(JsUtils $js=NULL,&$view=NULL){
84
-		if(!$this->_generated){
83
+	public function compile(JsUtils $js=NULL, &$view=NULL) {
84
+		if (!$this->_generated) {
85 85
 			$this->_instanceViewer->setInstance($this->_model);
86 86
 			$captions=$this->_instanceViewer->getCaptions();
87 87
 
88 88
 			$table=$this->content["table"];
89 89
 
90
-			if($this->_hasCheckboxes){
90
+			if ($this->_hasCheckboxes) {
91 91
 				$this->_generateMainCheckbox($captions);
92 92
 			}
93 93
 
94 94
 			$table->setRowCount(0, \sizeof($captions));
95
-			$this->_generateHeader($table,$captions);
95
+			$this->_generateHeader($table, $captions);
96 96
 
97
-			if(isset($this->_compileParts))
97
+			if (isset($this->_compileParts))
98 98
 				$table->setCompileParts($this->_compileParts);
99 99
 
100
-			if(isset($this->_searchField) && isset($js)){
101
-				if(isset($this->_urls["refresh"]))
102
-					$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
100
+			if (isset($this->_searchField) && isset($js)) {
101
+				if (isset($this->_urls["refresh"]))
102
+					$this->_searchField->postOn("change", $this->_urls["refresh"], "{'s':$(this).val()}", "#".$this->identifier." tbody", ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]);
103 103
 			}
104 104
 
105 105
 			$this->_generateContent($table);
106 106
 
107
-			if($this->_hasCheckboxes && $table->hasPart("thead")){
107
+			if ($this->_hasCheckboxes && $table->hasPart("thead")) {
108 108
 					$table->getHeader()->getCell(0, 0)->addClass("no-sort");
109 109
 			}
110 110
 
111
-			if(isset($this->_toolbar)){
111
+			if (isset($this->_toolbar)) {
112 112
 				$this->_setToolbarPosition($table, $captions);
113 113
 			}
114
-			if(isset($this->_pagination) && $this->_pagination->getVisible()){
115
-				$this->_generatePagination($table,$js);
114
+			if (isset($this->_pagination) && $this->_pagination->getVisible()) {
115
+				$this->_generatePagination($table, $js);
116 116
 			}
117 117
 
118
-			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE,"table",PositionInTable::AFTERTABLE]);
118
+			$this->content=JArray::sortAssociative($this->content, [PositionInTable::BEFORETABLE, "table", PositionInTable::AFTERTABLE]);
119 119
 			$this->_compileForm();
120 120
 
121 121
 			$this->_generated=true;
122 122
 		}
123
-		return parent::compile($js,$view);
123
+		return parent::compile($js, $view);
124 124
 	}
125 125
 
126
-	protected function _generateHeader(HtmlTable $table,$captions){
126
+	protected function _generateHeader(HtmlTable $table, $captions) {
127 127
 		$table->setHeaderValues($captions);
128
-		if(isset($this->_sortable)){
128
+		if (isset($this->_sortable)) {
129 129
 			$table->setSortable($this->_sortable);
130 130
 		}
131 131
 	}
132 132
 
133 133
 
134 134
 
135
-	protected function _generateContent($table){
135
+	protected function _generateContent($table) {
136 136
 		$objects=$this->_modelInstance;
137
-		if(isset($this->_pagination)){
137
+		if (isset($this->_pagination)) {
138 138
 			$objects=$this->_pagination->getObjects($this->_modelInstance);
139 139
 		}
140 140
 			InstanceViewer::setIndex(0);
141 141
 			$table->fromDatabaseObjects($objects, function($instance) use($table){
142 142
 				return $this->_generateRow($instance, $table);
143 143
 			});
144
-		if($table->getRowCount()==0){
144
+		if ($table->getRowCount()==0) {
145 145
 			$result=$table->addRow();
146 146
 			$result->mergeRow();
147 147
 			$result->setValues([$this->_emptyMessage]);
148 148
 		}
149 149
 	}
150 150
 
151
-	protected function _generateRow($instance,&$table,$checkedClass=null){
151
+	protected function _generateRow($instance, &$table, $checkedClass=null) {
152 152
 		$this->_instanceViewer->setInstance($instance);
153 153
 		InstanceViewer::$index++;
154
-		$values= $this->_instanceViewer->getValues();
155
-		if($this->_hasCheckboxes){
156
-			$ck=new HtmlCheckbox("ck-".$this->identifier,"");
154
+		$values=$this->_instanceViewer->getValues();
155
+		if ($this->_hasCheckboxes) {
156
+			$ck=new HtmlCheckbox("ck-".$this->identifier, "");
157 157
 			$field=$ck->getField();
158
-			$field->setProperty("value",$this->_instanceViewer->getIdentifier());
158
+			$field->setProperty("value", $this->_instanceViewer->getIdentifier());
159 159
 			$field->setProperty("name", "selection[]");
160
-			if(isset($checkedClass))
160
+			if (isset($checkedClass))
161 161
 				$field->setClass($checkedClass);
162 162
 			\array_unshift($values, $ck);
163 163
 		}
164 164
 		$result=$table->newRow();
165 165
 		$result->setIdentifier($this->identifier."-tr-".$this->_instanceViewer->getIdentifier());
166 166
 		$result->setValues($values);
167
-		$result->addToProperty("class",$this->_rowClass);
167
+		$result->addToProperty("class", $this->_rowClass);
168 168
 		return $result;
169 169
 	}
170 170
 
171
-	protected function _generatePagination($table,$js=NULL){
172
-		if(isset($this->_toolbar)){
173
-			if($this->_toolbarPosition==PositionInTable::FOOTER)
171
+	protected function _generatePagination($table, $js=NULL) {
172
+		if (isset($this->_toolbar)) {
173
+			if ($this->_toolbarPosition==PositionInTable::FOOTER)
174 174
 				$this->_toolbar->setFloated("left");
175 175
 		}
176 176
 		$footer=$table->getFooter();
177 177
 		$footer->mergeCol();
178
-		$menu=new HtmlPaginationMenu("pagination-".$this->identifier,$this->_pagination->getPagesNumbers());
178
+		$menu=new HtmlPaginationMenu("pagination-".$this->identifier, $this->_pagination->getPagesNumbers());
179 179
 		$menu->floatRight();
180 180
 		$menu->setActiveItem($this->_pagination->getPage()-1);
181 181
 		$footer->addValues($menu);
182
-		$this->_associatePaginationBehavior($menu,$js);
182
+		$this->_associatePaginationBehavior($menu, $js);
183 183
 	}
184 184
 
185
-	protected function _associatePaginationBehavior(HtmlMenu $menu,JsUtils $js=NULL){
186
-		if(isset($this->_urls["refresh"])){
187
-			$menu->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page')}",$this->getRefreshSelector(),["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
185
+	protected function _associatePaginationBehavior(HtmlMenu $menu, JsUtils $js=NULL) {
186
+		if (isset($this->_urls["refresh"])) {
187
+			$menu->postOnClick($this->_urls["refresh"], "{'p':$(this).attr('data-page')}", $this->getRefreshSelector(), ["preventDefault"=>false, "jqueryDone"=>"replaceWith"]);
188 188
 		}
189 189
 	}
190 190
 
191
-	protected function _getFieldName($index){
191
+	protected function _getFieldName($index) {
192 192
 		return parent::_getFieldName($index)."[]";
193 193
 	}
194 194
 
195
-	protected function _getFieldCaption($index){
195
+	protected function _getFieldCaption($index) {
196 196
 		return null;
197 197
 	}
198 198
 
199
-	protected function _setToolbarPosition($table,$captions=NULL){
200
-		switch ($this->_toolbarPosition){
199
+	protected function _setToolbarPosition($table, $captions=NULL) {
200
+		switch ($this->_toolbarPosition) {
201 201
 			case PositionInTable::BEFORETABLE:
202 202
 			case PositionInTable::AFTERTABLE:
203
-				if(isset($this->_compileParts)===false){
203
+				if (isset($this->_compileParts)===false) {
204 204
 					$this->content[$this->_toolbarPosition]=$this->_toolbar;
205 205
 				}
206 206
 				break;
207 207
 			case PositionInTable::HEADER:
208 208
 			case PositionInTable::FOOTER:
209 209
 			case PositionInTable::BODY:
210
-				$this->addToolbarRow($this->_toolbarPosition,$table, $captions);
210
+				$this->addToolbarRow($this->_toolbarPosition, $table, $captions);
211 211
 				break;
212 212
 		}
213 213
 	}
@@ -219,23 +219,23 @@  discard block
 block discarded – undo
219 219
 	 * @param callable $callback function called after the field compilation
220 220
 	 * @return DataTable
221 221
 	 */
222
-	public function afterCompile($index,$callback){
223
-		$this->_instanceViewer->afterCompile($index,$callback);
222
+	public function afterCompile($index, $callback) {
223
+		$this->_instanceViewer->afterCompile($index, $callback);
224 224
 		return $this;
225 225
 	}
226 226
 
227
-	private function addToolbarRow($part,$table,$captions){
227
+	private function addToolbarRow($part, $table, $captions) {
228 228
 		$hasPart=$table->hasPart($part);
229
-		if($hasPart){
229
+		if ($hasPart) {
230 230
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
231
-		}else{
231
+		} else {
232 232
 			$row=$table->getPart($part)->getRow(0);
233 233
 		}
234 234
 		$row->mergeCol();
235 235
 		$row->setValues([$this->_toolbar]);
236 236
 	}
237 237
 
238
-	public function getHtmlComponent(){
238
+	public function getHtmlComponent() {
239 239
 		return $this->content["table"];
240 240
 	}
241 241
 
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
 	 * @return DataTable
250 250
 	 */
251 251
 	public function setUrls($urls) {
252
-		if(\is_array($urls)){
253
-			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
254
-			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
255
-			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
256
-		}else{
257
-			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
252
+		if (\is_array($urls)) {
253
+			$this->_urls["refresh"]=JArray::getValue($urls, "refresh", 0);
254
+			$this->_urls["edit"]=JArray::getValue($urls, "edit", 1);
255
+			$this->_urls["delete"]=JArray::getValue($urls, "delete", 2);
256
+		} else {
257
+			$this->_urls=["refresh"=>$urls, "edit"=>$urls, "delete"=>$urls];
258 258
 		}
259 259
 		return $this;
260 260
 	}
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
 	 * @param number $pages_visibles The number of visible pages in the Pagination component
268 268
 	 * @return DataTable
269 269
 	 */
270
-	public function paginate($page,$total_rowcount,$items_per_page=10,$pages_visibles=null){
271
-		$this->_pagination=new Pagination($items_per_page,$pages_visibles,$page,$total_rowcount);
270
+	public function paginate($page, $total_rowcount, $items_per_page=10, $pages_visibles=null) {
271
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page, $total_rowcount);
272 272
 		return $this;
273 273
 	}
274 274
 
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
 	 * @param number $pages_visibles The number of visible pages in the Pagination component
280 280
 	 * @return DataTable
281 281
 	 */
282
-	public function autoPaginate($page=1,$items_per_page=10,$pages_visibles=4){
283
-		$this->_pagination=new Pagination($items_per_page,$pages_visibles,$page);
282
+	public function autoPaginate($page=1, $items_per_page=10, $pages_visibles=4) {
283
+		$this->_pagination=new Pagination($items_per_page, $pages_visibles, $page);
284 284
 		return $this;
285 285
 	}
286 286
 
@@ -290,20 +290,20 @@  discard block
 block discarded – undo
290 290
 	 * @param array $compileParts
291 291
 	 * @return DataTable
292 292
 	 */
293
-	public function refresh($compileParts=["tbody"]){
293
+	public function refresh($compileParts=["tbody"]) {
294 294
 		$this->_compileParts=$compileParts;
295 295
 		return $this;
296 296
 	}
297 297
 
298 298
 
299
-	public function addSearchInToolbar($position=Direction::RIGHT){
299
+	public function addSearchInToolbar($position=Direction::RIGHT) {
300 300
 		return $this->addInToolbar($this->getSearchField())->setPosition($position);
301 301
 	}
302 302
 
303
-	public function getSearchField(){
304
-		if(isset($this->_searchField)===false){
305
-			$this->_searchField=new HtmlInput("search-".$this->identifier,"search","","Search...");
306
-			$this->_searchField->addIcon("search",Direction::RIGHT);
303
+	public function getSearchField() {
304
+		if (isset($this->_searchField)===false) {
305
+			$this->_searchField=new HtmlInput("search-".$this->identifier, "search", "", "Search...");
306
+			$this->_searchField->addIcon("search", Direction::RIGHT);
307 307
 		}
308 308
 		return $this->_searchField;
309 309
 	}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		return $this;
320 320
 	}
321 321
 
322
-	public function asForm(){
322
+	public function asForm() {
323 323
 		return $this->getForm();
324 324
 	}
325 325
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
 	protected function getTargetSelector() {
329 329
 		$result=$this->_targetSelector;
330
-		if(!isset($result))
330
+		if (!isset($result))
331 331
 			$result="#".$this->identifier;
332 332
 		return $result;
333 333
 	}
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 	}
344 344
 
345 345
 	public function getRefreshSelector() {
346
-		if(isset($this->_refreshSelector))
346
+		if (isset($this->_refreshSelector))
347 347
 			return $this->_refreshSelector;
348 348
 		return "#".$this->identifier." tbody";
349 349
 	}
@@ -357,9 +357,9 @@  discard block
 block discarded – undo
357 357
 	 * {@inheritDoc}
358 358
 	 * @see \Ajax\common\Widget::show()
359 359
 	 */
360
-	public function show($modelInstance){
361
-		if(\is_array($modelInstance)){
362
-			if(\is_array(array_values($modelInstance)[0]))
360
+	public function show($modelInstance) {
361
+		if (\is_array($modelInstance)) {
362
+			if (\is_array(array_values($modelInstance)[0]))
363 363
 				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
364 364
 		}
365 365
 		$this->_modelInstance=$modelInstance;
Please login to merge, or discard this patch.
Braces   +29 added lines, -20 removed lines patch added patch discarded remove patch
@@ -55,10 +55,12 @@  discard block
 block discarded – undo
55 55
 			$js->execOn("mouseover", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'visible');",["preventDefault"=>false,"stopPropagation"=>true]);
56 56
 			$js->execOn("mouseout", "#".$this->identifier." tr", "$(event.target).closest('tr').find('.visibleover').css('visibility', 'hidden');",["preventDefault"=>false,"stopPropagation"=>true]);
57 57
 		}
58
-		if(\is_array($this->_deleteBehavior))
59
-			$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
60
-		if(\is_array($this->_editBehavior))
61
-			$this->_generateBehavior("edit",$this->_editBehavior,$js);
58
+		if(\is_array($this->_deleteBehavior)) {
59
+					$this->_generateBehavior("delete",$this->_deleteBehavior, $js);
60
+		}
61
+		if(\is_array($this->_editBehavior)) {
62
+					$this->_generateBehavior("edit",$this->_editBehavior,$js);
63
+		}
62 64
 		return parent::run($js);
63 65
 	}
64 66
 
@@ -94,12 +96,14 @@  discard block
 block discarded – undo
94 96
 			$table->setRowCount(0, \sizeof($captions));
95 97
 			$this->_generateHeader($table,$captions);
96 98
 
97
-			if(isset($this->_compileParts))
98
-				$table->setCompileParts($this->_compileParts);
99
+			if(isset($this->_compileParts)) {
100
+							$table->setCompileParts($this->_compileParts);
101
+			}
99 102
 
100 103
 			if(isset($this->_searchField) && isset($js)){
101
-				if(isset($this->_urls["refresh"]))
102
-					$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
104
+				if(isset($this->_urls["refresh"])) {
105
+									$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
106
+				}
103 107
 			}
104 108
 
105 109
 			$this->_generateContent($table);
@@ -157,8 +161,9 @@  discard block
 block discarded – undo
157 161
 			$field=$ck->getField();
158 162
 			$field->setProperty("value",$this->_instanceViewer->getIdentifier());
159 163
 			$field->setProperty("name", "selection[]");
160
-			if(isset($checkedClass))
161
-				$field->setClass($checkedClass);
164
+			if(isset($checkedClass)) {
165
+							$field->setClass($checkedClass);
166
+			}
162 167
 			\array_unshift($values, $ck);
163 168
 		}
164 169
 		$result=$table->newRow();
@@ -170,8 +175,9 @@  discard block
 block discarded – undo
170 175
 
171 176
 	protected function _generatePagination($table,$js=NULL){
172 177
 		if(isset($this->_toolbar)){
173
-			if($this->_toolbarPosition==PositionInTable::FOOTER)
174
-				$this->_toolbar->setFloated("left");
178
+			if($this->_toolbarPosition==PositionInTable::FOOTER) {
179
+							$this->_toolbar->setFloated("left");
180
+			}
175 181
 		}
176 182
 		$footer=$table->getFooter();
177 183
 		$footer->mergeCol();
@@ -228,7 +234,7 @@  discard block
 block discarded – undo
228 234
 		$hasPart=$table->hasPart($part);
229 235
 		if($hasPart){
230 236
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
231
-		}else{
237
+		} else{
232 238
 			$row=$table->getPart($part)->getRow(0);
233 239
 		}
234 240
 		$row->mergeCol();
@@ -253,7 +259,7 @@  discard block
 block discarded – undo
253 259
 			$this->_urls["refresh"]=JArray::getValue($urls, "refresh",0);
254 260
 			$this->_urls["edit"]=JArray::getValue($urls, "edit",1);
255 261
 			$this->_urls["delete"]=JArray::getValue($urls, "delete",2);
256
-		}else{
262
+		} else{
257 263
 			$this->_urls=["refresh"=>$urls,"edit"=>$urls,"delete"=>$urls];
258 264
 		}
259 265
 		return $this;
@@ -327,8 +333,9 @@  discard block
 block discarded – undo
327 333
 
328 334
 	protected function getTargetSelector() {
329 335
 		$result=$this->_targetSelector;
330
-		if(!isset($result))
331
-			$result="#".$this->identifier;
336
+		if(!isset($result)) {
337
+					$result="#".$this->identifier;
338
+		}
332 339
 		return $result;
333 340
 	}
334 341
 
@@ -343,8 +350,9 @@  discard block
 block discarded – undo
343 350
 	}
344 351
 
345 352
 	public function getRefreshSelector() {
346
-		if(isset($this->_refreshSelector))
347
-			return $this->_refreshSelector;
353
+		if(isset($this->_refreshSelector)) {
354
+					return $this->_refreshSelector;
355
+		}
348 356
 		return "#".$this->identifier." tbody";
349 357
 	}
350 358
 
@@ -359,8 +367,9 @@  discard block
 block discarded – undo
359 367
 	 */
360 368
 	public function show($modelInstance){
361 369
 		if(\is_array($modelInstance)){
362
-			if(\is_array(array_values($modelInstance)[0]))
363
-				$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
370
+			if(\is_array(array_values($modelInstance)[0])) {
371
+							$modelInstance=\json_decode(\json_encode($modelInstance), FALSE);
372
+			}
364 373
 		}
365 374
 		$this->_modelInstance=$modelInstance;
366 375
 	}
Please login to merge, or discard this patch.