From 35b472e9f537a54d40ba25e168fb2cdc20f5d1b4 Mon Sep 17 00:00:00 2001 From: Eric Lagarda Date: Thu, 22 Nov 2018 12:29:41 +0000 Subject: [PATCH] Apply fixes from StyleCI --- routes/api.php | 14 +++++++------- .../Controllers/ResourceGeneratorController.php | 12 ++++++------ src/Http/Services/Settings.php | 10 +++++----- src/ResourceGeneratorServiceProvider.php | 14 +++++++------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/routes/api.php b/routes/api.php index 377eb46..733f0e0 100644 --- a/routes/api.php +++ b/routes/api.php @@ -12,11 +12,11 @@ | by your tool's "Authorize" middleware by default. Now, go build! | */ -Route::any('/get-tables', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class . '@getTables'); -Route::any('/get-columns', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class . '@getColumns'); -Route::post('/check-file', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class . '@checkFile'); -Route::post('/generate-resource', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class . '@generateFile'); +Route::any('/get-tables', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class.'@getTables'); +Route::any('/get-columns', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class.'@getColumns'); +Route::post('/check-file', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class.'@checkFile'); +Route::post('/generate-resource', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorController::class.'@generateFile'); -Route::get('/settings-get', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class . '@getSettings'); -Route::post('/settings-set', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class . '@setSettings'); -Route::post('/settings-reset', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class . '@resetDefault'); +Route::get('/settings-get', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class.'@getSettings'); +Route::post('/settings-set', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class.'@setSettings'); +Route::post('/settings-reset', \Cloudstudio\ResourceGenerator\Http\Controllers\ResourceGeneratorOptionsController::class.'@resetDefault'); diff --git a/src/Http/Controllers/ResourceGeneratorController.php b/src/Http/Controllers/ResourceGeneratorController.php index a9b1f9e..5030b12 100644 --- a/src/Http/Controllers/ResourceGeneratorController.php +++ b/src/Http/Controllers/ResourceGeneratorController.php @@ -2,11 +2,11 @@ namespace Cloudstudio\ResourceGenerator\Http\Controllers; -use Cloudstudio\ResourceGenerator\Http\Services\GeneratorFunctions; -use Cloudstudio\ResourceGenerator\Http\Services\ResourceGeneratorService; -use Cloudstudio\ResourceGenerator\Http\Services\Settings; use Illuminate\Http\Request; use Illuminate\Routing\Controller; +use Cloudstudio\ResourceGenerator\Http\Services\Settings; +use Cloudstudio\ResourceGenerator\Http\Services\GeneratorFunctions; +use Cloudstudio\ResourceGenerator\Http\Services\ResourceGeneratorService; class ResourceGeneratorController extends Controller { @@ -38,8 +38,8 @@ public function checkFile(Request $request) { if ($request->has('createModel')) { $modelNamespace = $this->setting->getSettings()->namespace->value; - $last = substr($modelNamespace, -1); - ($last == '\\') ? $modelNamespace : $modelNamespace . '\\'; + $last = substr($modelNamespace, -1); + ($last == '\\') ? $modelNamespace : $modelNamespace.'\\'; $model = $this->checkIfFileExist($modelNamespace, $request->get('singular')); } @@ -97,7 +97,7 @@ public function generateModel($data, $namespace) public function generateFile(Request $request) { $namespace = $this->setting->value('namespace'); - $resource = $this->setting->value('resource'); + $resource = $this->setting->value('resource'); $this->generateResource($request, $this->getNamespace(), $namespace, $resource); diff --git a/src/Http/Services/Settings.php b/src/Http/Services/Settings.php index c06a6f2..8f86db0 100644 --- a/src/Http/Services/Settings.php +++ b/src/Http/Services/Settings.php @@ -136,7 +136,7 @@ private function getSettingsFile() if (file_exists($this->filePath)) { $jsonContents = file_get_contents($this->filePath); - if (!$this->isJson($jsonContents)) { + if (! $this->isJson($jsonContents)) { $this->setDefaultSettings(); } } else { @@ -144,9 +144,9 @@ private function getSettingsFile() } $jsonContents = file_get_contents($this->filePath); - $settings = json_decode($jsonContents, true); - $settings = json_decode(json_encode($settings, JSON_FORCE_OBJECT), false); - $settings = $this->cleanArrays($settings); + $settings = json_decode($jsonContents, true); + $settings = json_decode(json_encode($settings, JSON_FORCE_OBJECT), false); + $settings = $this->cleanArrays($settings); return $settings; } @@ -170,7 +170,7 @@ private function cleanArrays($settings) */ public function setDefaultSettings() { - $settings = file_get_contents(__DIR__ . '/../../../settings.json'); + $settings = file_get_contents(__DIR__.'/../../../settings.json'); return file_put_contents($this->filePath, $settings); } diff --git a/src/ResourceGeneratorServiceProvider.php b/src/ResourceGeneratorServiceProvider.php index f22b672..93b7946 100644 --- a/src/ResourceGeneratorServiceProvider.php +++ b/src/ResourceGeneratorServiceProvider.php @@ -2,11 +2,11 @@ namespace Cloudstudio\ResourceGenerator; -use Cloudstudio\ResourceGenerator\Http\Middleware\Authorize; +use Laravel\Nova\Nova; +use Laravel\Nova\Events\ServingNova; use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; -use Laravel\Nova\Events\ServingNova; -use Laravel\Nova\Nova; +use Cloudstudio\ResourceGenerator\Http\Middleware\Authorize; class ResourceGeneratorServiceProvider extends ServiceProvider { @@ -17,7 +17,7 @@ class ResourceGeneratorServiceProvider extends ServiceProvider */ public function boot() { - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'resource-generator'); + $this->loadViewsFrom(__DIR__.'/../resources/views', 'resource-generator'); $this->app->booted(function () { $this->routes(); @@ -38,7 +38,7 @@ protected function routes() Route::middleware(['nova', Authorize::class]) ->prefix('nova-vendor/resource-generator') - ->group(__DIR__ . '/../routes/api.php'); + ->group(__DIR__.'/../routes/api.php'); } /** @@ -59,8 +59,8 @@ public function register() private function checkSettingsFile() { $settingsFile = storage_path('nova-resource-generator.json'); - if (!file_exists($settingsFile)) { - $settings = file_get_contents(__DIR__ . '/../settings.json'); + if (! file_exists($settingsFile)) { + $settings = file_get_contents(__DIR__.'/../settings.json'); file_put_contents($settingsFile, $settings); }