Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit fe2c035

Browse files
committed
#75: update the aggregator based on phpcs feedback
1 parent 31f238e commit fe2c035

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

app/code/Magento/ImportExport/Model/Import/ErrorProcessing/ProcessingErrorAggregator.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ public function __construct(
6161
}
6262

6363
/**
64+
* Add error via code and level
65+
*
6466
* @param string $errorCode
6567
* @param string $errorLevel
6668
* @param int|null $rowNumber
@@ -96,6 +98,8 @@ public function addError(
9698
}
9799

98100
/**
101+
* Add row to be skipped during import
102+
*
99103
* @param int $rowNumber
100104
* @return $this
101105
*/
@@ -110,6 +114,8 @@ public function addRowToSkip($rowNumber)
110114
}
111115

112116
/**
117+
* Add specific row to invalid list via row number
118+
*
113119
* @param int $rowNumber
114120
* @return $this
115121
*/
@@ -126,6 +132,8 @@ protected function processInvalidRow($rowNumber)
126132
}
127133

128134
/**
135+
* Add error message template
136+
*
129137
* @param string $code
130138
* @param string $template
131139
* @return $this
@@ -138,6 +146,8 @@ public function addErrorMessageTemplate($code, $template)
138146
}
139147

140148
/**
149+
* Check if row is invalid by row number
150+
*
141151
* @param int $rowNumber
142152
* @return bool
143153
*/
@@ -147,6 +157,8 @@ public function isRowInvalid($rowNumber)
147157
}
148158

149159
/**
160+
* Get number of invalid rows
161+
*
150162
* @return int
151163
*/
152164
public function getInvalidRowsCount()
@@ -155,6 +167,8 @@ public function getInvalidRowsCount()
155167
}
156168

157169
/**
170+
* Initialize validation strategy
171+
*
158172
* @param string $validationStrategy
159173
* @param int $allowedErrorCount
160174
* @return $this
@@ -178,6 +192,8 @@ public function initValidationStrategy($validationStrategy, $allowedErrorCount =
178192
}
179193

180194
/**
195+
* Check if import has to be terminated
196+
*
181197
* @return bool
182198
*/
183199
public function hasToBeTerminated()
@@ -186,6 +202,8 @@ public function hasToBeTerminated()
186202
}
187203

188204
/**
205+
* Check if error limit has been exceeded
206+
*
189207
* @return bool
190208
*/
191209
public function isErrorLimitExceeded()
@@ -203,6 +221,8 @@ public function isErrorLimitExceeded()
203221
}
204222

205223
/**
224+
* Check if import has a fatal error
225+
*
206226
* @return bool
207227
*/
208228
public function hasFatalExceptions()
@@ -211,6 +231,8 @@ public function hasFatalExceptions()
211231
}
212232

213233
/**
234+
* Get all errors from an import process
235+
*
214236
* @return ProcessingError[]
215237
*/
216238
public function getAllErrors()
@@ -228,6 +250,8 @@ public function getAllErrors()
228250
}
229251

230252
/**
253+
* Get a specific set of errors via codes
254+
*
231255
* @param string[] $codes
232256
* @return ProcessingError[]
233257
*/
@@ -244,6 +268,8 @@ public function getErrorsByCode(array $codes)
244268
}
245269

246270
/**
271+
* Get an error via row number
272+
*
247273
* @param int $rowNumber
248274
* @return ProcessingError[]
249275
*/
@@ -258,6 +284,8 @@ public function getErrorByRowNumber($rowNumber)
258284
}
259285

260286
/**
287+
* Get a set rows via a set of error codes
288+
*
261289
* @param array $errorCode
262290
* @param array $excludedCodes
263291
* @param bool $replaceCodeWithMessage
@@ -292,6 +320,8 @@ public function getRowsGroupedByErrorCode(
292320
}
293321

294322
/**
323+
* Get the max allowed error count
324+
*
295325
* @return int
296326
*/
297327
public function getAllowedErrorsCount()
@@ -300,6 +330,8 @@ public function getAllowedErrorsCount()
300330
}
301331

302332
/**
333+
* Get current error count
334+
*
303335
* @param string[] $errorLevels
304336
* @return int
305337
*/
@@ -318,6 +350,8 @@ public function getErrorsCount(
318350
}
319351

320352
/**
353+
* Clear the error aggregator
354+
*
321355
* @return $this
322356
*/
323357
public function clear()
@@ -331,6 +365,8 @@ public function clear()
331365
}
332366

333367
/**
368+
* Check if an error has already been added to the aggregator
369+
*
334370
* @param int $rowNum
335371
* @param string $errorCode
336372
* @param string $columnName
@@ -348,6 +384,8 @@ protected function isErrorAlreadyAdded($rowNum, $errorCode, $columnName = null)
348384
}
349385

350386
/**
387+
* Build an error message via code, message and column name
388+
*
351389
* @param string $errorCode
352390
* @param string $errorMessage
353391
* @param string $columnName
@@ -369,6 +407,8 @@ protected function getErrorMessage($errorCode, $errorMessage, $columnName)
369407
}
370408

371409
/**
410+
* Process the error statistics for a given error level
411+
*
372412
* @param string $errorLevel
373413
* @return $this
374414
*/

0 commit comments

Comments
 (0)