Fix formatting and interfaces in nearly every file

This commit is contained in:
Nabeel Shahzad
2018-03-19 20:50:40 -05:00
parent 04c5b9e7bf
commit ccf56ddec1
331 changed files with 3282 additions and 2492 deletions

View File

@@ -2,16 +2,23 @@
namespace App\Console\Commands;
use App\Console\BaseCommand;
use App\Console\Command;
use App\Services\DatabaseService;
class YamlImport extends BaseCommand
/**
* Class YamlImport
* @package App\Console\Commands
*/
class YamlImport extends Command
{
protected $signature = 'phpvms:import {files*}';
protected $description = 'Developer commands';
protected $dbSvc;
/**
* YamlImport constructor.
* @param DatabaseService $dbSvc
*/
public function __construct(DatabaseService $dbSvc)
{
parent::__construct();
@@ -20,31 +27,28 @@ class YamlImport extends BaseCommand
/**
* Run dev related commands
* @throws \Exception
*/
public function handle()
{
$files = $this->argument('files');
if(empty($files)) {
if (empty($files)) {
$this->error('No files to import specified!');
exit();
}
$ignore_errors = true;
/*$ignore_errors = $this->option('ignore_errors');
if(!$ignore_errors) {
$ignore_errors = false;
}*/
foreach($files as $file) {
if(!file_exists($file)) {
$this->error('File ' . $file .' doesn\'t exist');
foreach ($files as $file) {
if (!file_exists($file)) {
$this->error('File '.$file.' doesn\'t exist');
exit;
}
$this->info('Importing ' . $file);
$this->info('Importing '.$file);
$imported = $this->dbSvc->seed_from_yaml_file($file, $ignore_errors);
foreach($imported as $table => $count) {
foreach ($imported as $table => $count) {
$this->info('Imported '.$count.' records from "'.$table.'"');
}
}