8
8
use Magento \Framework \App \Filesystem \DirectoryList ;
9
9
10
10
/**
11
+ * Extended Grid Widget
12
+ *
11
13
* @api
12
14
* @deprecated 100.2.0 in favour of UI component implementation
13
15
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
@@ -177,7 +179,10 @@ class Extended extends \Magento\Backend\Block\Widget\Grid implements \Magento\Ba
177
179
protected $ _path = 'export ' ;
178
180
179
181
/**
182
+ * Initialization
183
+ *
180
184
* @return void
185
+ * @throws \Magento\Framework\Exception\FileSystemException
181
186
*/
182
187
protected function _construct ()
183
188
{
@@ -297,6 +302,7 @@ public function addColumn($columnId, $column)
297
302
);
298
303
$ this ->getColumnSet ()->getChildBlock ($ columnId )->setGrid ($ this );
299
304
} else {
305
+ // phpcs:ignore Magento2.Exceptions.DirectThrow
300
306
throw new \Exception (__ ('Please correct the column format and try again. ' ));
301
307
}
302
308
@@ -471,12 +477,6 @@ protected function _prepareMassactionColumn()
471
477
protected function _prepareCollection ()
472
478
{
473
479
if ($ this ->getCollection ()) {
474
- /*
475
- if ($this->getCollection()->isLoaded()) {
476
- $this->getCollection()->clear();
477
- }
478
- */
479
-
480
480
parent ::_prepareCollection ();
481
481
482
482
if (!$ this ->_isExport ) {
@@ -665,6 +665,7 @@ public function setEmptyCellLabel($label)
665
665
*/
666
666
public function getRowUrl ($ item )
667
667
{
668
+ // phpstan:ignore "Call to an undefined static method"
668
669
$ res = parent ::getRowUrl ($ item );
669
670
return $ res ? $ res : '# ' ;
670
671
}
@@ -682,6 +683,7 @@ public function getMultipleRows($item)
682
683
683
684
/**
684
685
* Retrieve columns for multiple rows
686
+ *
685
687
* @return array
686
688
*/
687
689
public function getMultipleRowColumns ()
@@ -945,6 +947,7 @@ protected function _getExportTotals()
945
947
946
948
/**
947
949
* Iterate collection and call callback method per item
950
+ *
948
951
* For callback method first argument always is item object
949
952
*
950
953
* @param string $callback
@@ -974,7 +977,12 @@ public function _exportIterateCollection($callback, array $args)
974
977
$ page ++;
975
978
976
979
foreach ($ collection as $ item ) {
977
- call_user_func_array ([$ this , $ callback ], array_merge ([$ item ], $ args ));
980
+ //phpcs:ignore Magento2.Functions.DiscouragedFunction
981
+ call_user_func_array (
982
+ [$ this , $ callback ],
983
+ // phpcs:ignore Magento2.Performance.ForeachArrayMerge
984
+ array_merge ([$ item ], $ args )
985
+ );
978
986
}
979
987
}
980
988
}
@@ -1011,6 +1019,7 @@ public function getCsvFile()
1011
1019
$ this ->_isExport = true ;
1012
1020
$ this ->_prepareGrid ();
1013
1021
1022
+ // phpcs:ignore Magento2.Security.InsecureFunction
1014
1023
$ name = md5 (microtime ());
1015
1024
$ file = $ this ->_path . '/ ' . $ name . '.csv ' ;
1016
1025
@@ -1155,6 +1164,7 @@ public function getExcelFile($sheetName = '')
1155
1164
[$ this , 'getRowRecord ' ]
1156
1165
);
1157
1166
1167
+ // phpcs:ignore Magento2.Security.InsecureFunction
1158
1168
$ name = md5 (microtime ());
1159
1169
$ file = $ this ->_path . '/ ' . $ name . '.xml ' ;
1160
1170
@@ -1246,7 +1256,7 @@ public function setCollection($collection)
1246
1256
}
1247
1257
1248
1258
/**
1249
- * get collection object
1259
+ * Get collection object
1250
1260
*
1251
1261
* @return \Magento\Framework\Data\Collection
1252
1262
*/
0 commit comments