[DEV-239] Prettify code

This commit is contained in:
LautaroCesso 2022-02-18 18:30:49 -03:00
parent 7996c933c6
commit e07e9c5b8e
1 changed files with 2 additions and 10 deletions

View File

@ -42,13 +42,7 @@ class CSVImportController extends Controller {
$file = fopen($fileUploader->getFullFilePath(),'r');
$errors = [];
$user = fgetcsv($file);
while($user != null) {
if($user == false) {
throw new RequestException("Error trying to read file");
}
while(($user = fgetcsv($file)) != false) {
Controller::setDataRequester(function ($key) use ($user) {
switch ($key) {
case 'email':
@ -70,8 +64,6 @@ class CSVImportController extends Controller {
} catch (\Exception $exception) {
$errors[] = $exception->getMessage() . ' in email ' . $user[0];
}
$user = fgetcsv($file);
}
fclose($file);
@ -80,4 +72,4 @@ class CSVImportController extends Controller {
Response::respondSuccess($errors);
}
}
}