[DEV-239] Prettify code
This commit is contained in:
parent
7996c933c6
commit
e07e9c5b8e
|
@ -42,13 +42,7 @@ class CSVImportController extends Controller {
|
||||||
$file = fopen($fileUploader->getFullFilePath(),'r');
|
$file = fopen($fileUploader->getFullFilePath(),'r');
|
||||||
$errors = [];
|
$errors = [];
|
||||||
|
|
||||||
$user = fgetcsv($file);
|
while(($user = fgetcsv($file)) != false) {
|
||||||
|
|
||||||
while($user != null) {
|
|
||||||
if($user == false) {
|
|
||||||
throw new RequestException("Error trying to read file");
|
|
||||||
}
|
|
||||||
|
|
||||||
Controller::setDataRequester(function ($key) use ($user) {
|
Controller::setDataRequester(function ($key) use ($user) {
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
case 'email':
|
case 'email':
|
||||||
|
@ -70,8 +64,6 @@ class CSVImportController extends Controller {
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
$errors[] = $exception->getMessage() . ' in email ' . $user[0];
|
$errors[] = $exception->getMessage() . ' in email ' . $user[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = fgetcsv($file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
@ -80,4 +72,4 @@ class CSVImportController extends Controller {
|
||||||
|
|
||||||
Response::respondSuccess($errors);
|
Response::respondSuccess($errors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue