Passed
Push — master ( 5b6b0f...13de68 )
by Nicolaas
02:47 queued 15s
created
src/ExportAllCustomButton.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     {
77 77
         $modelClass = $gridField->getModelClass();
78 78
         $custom = Config::inst()->get(static::class, 'custom_exports');
79
-        if (empty($custom[$modelClass]) || ! is_array($custom[$modelClass])) {
79
+        if (empty($custom[$modelClass]) || !is_array($custom[$modelClass])) {
80 80
             return parent::generateExportFileData($gridField);
81 81
         }
82 82
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
         $csvWriter->setOutputBOM(Writer::BOM_UTF8);
94 94
 
95 95
         if (!Config::inst()->get(static::class, 'xls_export_disabled')) {
96
-            $csvWriter->addFormatter(function (array $row) {
96
+            $csvWriter->addFormatter(function(array $row) {
97 97
                 foreach ($row as &$item) {
98 98
                     // [SS-2017-007] Sanitise XLS executable column values with a leading tab
99 99
                     if (preg_match('/^[-@=+].*/', $item ?? '')) {
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
             return $csvWriter->toString();
124 124
         }
125 125
 
126
-        return (string)$csvWriter;
126
+        return (string) $csvWriter;
127 127
     }
128 128
 
129 129
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                     // relation object details
201 201
                     $rel = $item->$methodName();
202 202
                     $this->joinTableCache[$relName] = [
203
-                        'foreign' => $rel->getForeignKey(),// e.g. MyExportRecordID
203
+                        'foreign' => $rel->getForeignKey(), // e.g. MyExportRecordID
204 204
                     ];
205 205
                     // NB!!!!!!!!!!!!!!
206 206
                     // local and foreign are swapped here on purpose
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
 
209 209
                     $list = $className::get()->limit($limit)->map('ID', $fieldRelatingToModelExported)->toArray();
210 210
                     foreach ($list as $idOfRelatedItem => $idOfModelExported) {
211
-                        if (! isset($this->lookupTableCache[$relName][$idOfModelExported])) {
211
+                        if (!isset($this->lookupTableCache[$relName][$idOfModelExported])) {
212 212
                             $this->lookupTableCache[$relName][$idOfModelExported] = [];
213 213
                         }
214 214
                         $this->lookupTableCache[$relName][$idOfModelExported][] = $idOfRelatedItem;
215 215
                     }
216 216
                 }
217
-                if (! empty($this->lookupTableCache[$relName][$item->ID])) {
217
+                if (!empty($this->lookupTableCache[$relName][$item->ID])) {
218 218
                     foreach ($this->lookupTableCache[$relName][$item->ID] as $fieldRelatingToLookupRelation) {
219 219
                         $result[] = $this->lookupTableCache[$classNameForArray][$fieldRelatingToLookupRelation] ?? '';
220 220
                     }
@@ -232,12 +232,12 @@  discard block
 block discarded – undo
232 232
                     // NB!!!!!!!!!!!!!!
233 233
                     // local and foreign are swapped here on purpose
234 234
                     $fieldRelatingToModelExported = $this->joinTableCache[$relName]['foreign']; // e.g. MyExportRecordID
235
-                    $fieldRelatingToLookupRelation = $this->joinTableCache[$relName]['local'];// e.g. MyRelationID
235
+                    $fieldRelatingToLookupRelation = $this->joinTableCache[$relName]['local']; // e.g. MyRelationID
236 236
 
237 237
                     $limit = Config::inst()->get(static::class, 'limit_to_join_tables');
238 238
                     $list = DB::query('SELECT "' . $fieldRelatingToModelExported . '", "' . $fieldRelatingToLookupRelation . '" FROM "' . $joinTable . '" LIMIT ' . $limit);
239 239
                     foreach ($list as $row) {
240
-                        if (! isset($this->lookupTableCache[$joinTable][$row[$fieldRelatingToModelExported]])) {
240
+                        if (!isset($this->lookupTableCache[$joinTable][$row[$fieldRelatingToModelExported]])) {
241 241
                             $this->lookupTableCache[$joinTable][$row[$fieldRelatingToModelExported]] = [];
242 242
                         }
243 243
                         $this->lookupTableCache[$joinTable][$row[$fieldRelatingToModelExported]][] = $row[$fieldRelatingToLookupRelation];
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                 } else {
246 246
                     $joinTable = $this->joinTableCache[$relName]['table'];
247 247
                 }
248
-                if (! empty($this->lookupTableCache[$joinTable][$item->ID])) {
248
+                if (!empty($this->lookupTableCache[$joinTable][$item->ID])) {
249 249
                     foreach ($this->lookupTableCache[$joinTable][$item->ID] as $fieldRelatingToLookupRelation) {
250 250
                         $result[] = $this->lookupTableCache[$classNameForArray][$fieldRelatingToLookupRelation] ?? '';
251 251
                     }
Please login to merge, or discard this patch.