From df8b5f88bfb53d117b5b565c8d3805e68bb75e99 Mon Sep 17 00:00:00 2001 From: Afdal Date: Thu, 20 May 2021 07:08:35 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/BadasoDeploymentOrchestrator.php | 2 +- src/Controllers/BadasoCRUDController.php | 18 +++++++++--------- src/Helpers/HiddenWatchTableConfig.php | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/BadasoDeploymentOrchestrator.php b/src/BadasoDeploymentOrchestrator.php index 911f4edd5..3a4e9a386 100644 --- a/src/BadasoDeploymentOrchestrator.php +++ b/src/BadasoDeploymentOrchestrator.php @@ -46,7 +46,7 @@ public function __construct(Application $application) */ public function handle(CRUDDataChanged $crud_data_changed) { - if (!in_array( + if (! in_array( $crud_data_changed->data_type->name, config('badaso-watch-tables') ) diff --git a/src/Controllers/BadasoCRUDController.php b/src/Controllers/BadasoCRUDController.php index 43edfecd5..37f720a92 100644 --- a/src/Controllers/BadasoCRUDController.php +++ b/src/Controllers/BadasoCRUDController.php @@ -37,7 +37,7 @@ public function browse(Request $request) $tables = SchemaManager::listTables(); $tables_with_crud_data = []; foreach ($tables as $key => $value) { - if (!in_array($key, $protected_tables)) { + if (! in_array($key, $protected_tables)) { // add table watch config $config_watch_tables->addWatchTable($key); // end add table watch config @@ -73,7 +73,7 @@ public function read(Request $request) foreach ($table_fields as $key => $column) { $field = $key; $column = collect($column)->toArray(); - if (!in_array($field, $generated_fields)) { + if (! in_array($field, $generated_fields)) { $data_row['data_type_id'] = $data_type->id; $data_row['field'] = $key; $data_row['type'] = DataTypeToComponent::convert($column['type']); @@ -133,7 +133,7 @@ public function edit(Request $request) 'required', "unique:data_types,name,{$request->id}", function ($attribute, $value, $fail) { - if (!Schema::hasTable($value)) { + if (! Schema::hasTable($value)) { $fail(__('badaso::validation.crud.table_not_found', ['table' => $value])); } }, @@ -142,13 +142,13 @@ function ($attribute, $value, $fail) { 'rows.*.field' => [ 'required', function ($attribute, $value, $fail) use ($request) { - if (!Schema::hasColumn($request->name, $value)) { + if (! Schema::hasColumn($request->name, $value)) { $fail(__('badaso::validation.crud.table_column_not_found', ['table_column' => "$request->name.{$value}"])); } else { $table_fields = SchemaManager::describeTable($request->name); $field = collect($table_fields)->where('field', $value)->first(); $row = collect($request->rows)->where('field', $value)->first(); - if (!$row['add'] && !$field['autoincrement'] && $field['notnull'] && is_null($field['default'])) { + if (! $row['add'] && ! $field['autoincrement'] && $field['notnull'] && is_null($field['default'])) { $fail(__('badaso::validation.crud.table_column_not_have_default_value', ['table_column' => "$request->name.{$value}"])); } } @@ -268,7 +268,7 @@ public function add(Request $request) 'required', 'unique:data_types', function ($attribute, $value, $fail) { - if (!Schema::hasTable($value)) { + if (! Schema::hasTable($value)) { $fail(__('badaso::validation.crud.table_not_found', ['table' => $value])); } }, @@ -278,13 +278,13 @@ function ($attribute, $value, $fail) { 'rows.*.field' => [ 'required', function ($attribute, $value, $fail) use ($request) { - if (!Schema::hasColumn($request->name, $value)) { + if (! Schema::hasColumn($request->name, $value)) { $fail(__('badaso::validation.crud.table_column_not_found', ['table_column' => "$request->name.{$value}"])); } else { $table_fields = SchemaManager::describeTable($request->name); $field = collect($table_fields)->where('field', $value)->first(); $row = collect($request->rows)->where('field', $value)->first(); - if (!$row['add'] && !$field['autoincrement'] && $field['notnull'] && is_null($field['default'])) { + if (! $row['add'] && ! $field['autoincrement'] && $field['notnull'] && is_null($field['default'])) { $fail(__('badaso::validation.crud.table_column_not_have_default_value', ['table_column' => "$request->name.{$value}"])); } } @@ -469,7 +469,7 @@ private function generateAPIDocs($table_name, $data_rows, $data_type) $filesystem = new LaravelFileSystem(); $file_path = ApiDocs::getFilePath($table_name); $stub = ApiDocs::getStub($table_name, $data_rows, $data_type); - if (!$filesystem->put($file_path, $stub)) { + if (! $filesystem->put($file_path, $stub)) { return false; } diff --git a/src/Helpers/HiddenWatchTableConfig.php b/src/Helpers/HiddenWatchTableConfig.php index d6524aba2..d78945016 100644 --- a/src/Helpers/HiddenWatchTableConfig.php +++ b/src/Helpers/HiddenWatchTableConfig.php @@ -22,7 +22,7 @@ public function __construct() public function addWatchTable($table_name): self { - if (!in_array($table_name, $this->watch_tables)) { + if (! in_array($table_name, $this->watch_tables)) { $this->watch_tables[count($this->watch_tables)] = $table_name; $this->saveWatchTable(); } @@ -51,7 +51,7 @@ public function saveWatchTable(): void public function addHiddenTable($table_name): self { - if (!in_array($table_name, $this->hidden_tables)) { + if (! in_array($table_name, $this->hidden_tables)) { $this->hidden_tables[count($this->hidden_tables)] = $table_name; $this->saveHiddenTable();