From 1897741381ea95301024489211cbc48061bdc6f0 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 12 Mar 2017 16:34:43 -0400 Subject: [PATCH] StyleCI cleanup --- app/Http/Controllers/Admin/OptionController.php | 5 ++--- app/Http/Controllers/Admin/ServiceController.php | 12 ------------ app/Http/Controllers/Daemon/ServiceController.php | 2 +- app/Models/Service.php | 2 +- app/Repositories/OptionRepository.php | 1 - app/Repositories/ServiceRepository.php | 5 +---- ...17_03_10_162934_AddNewServiceOptionsColumns.php | 4 ++-- ...2017_03_10_173607_MigrateToNewServiceSystem.php | 14 ++++++-------- ...15455_ChangeServiceVariablesValidationRules.php | 4 ++-- ...3_12_150648_MoveFunctionsFromFileToDatabase.php | 4 ++-- 10 files changed, 17 insertions(+), 36 deletions(-) diff --git a/app/Http/Controllers/Admin/OptionController.php b/app/Http/Controllers/Admin/OptionController.php index 837e5a8aa..68ddfaf9e 100644 --- a/app/Http/Controllers/Admin/OptionController.php +++ b/app/Http/Controllers/Admin/OptionController.php @@ -26,7 +26,6 @@ namespace Pterodactyl\Http\Controllers\Admin; use Log; use Alert; -use Storage; use Javascript; use Illuminate\Http\Request; use Pterodactyl\Models\Service; @@ -67,7 +66,7 @@ class OptionController extends Controller $option = $repo->create($request->intersect([ 'service_id', 'name', 'description', 'tag', 'docker_image', 'startup', 'config_from', 'config_startup', - 'config_logs', 'config_files', 'config_stop' + 'config_logs', 'config_files', 'config_stop', ])); Alert::success('Successfully created new service option.')->flash(); @@ -195,7 +194,7 @@ class OptionController extends Controller Alert::success("The service variable '{$variable->name}' has been updated.")->flash(); } else { $repo->delete($variable); - Alert::success("That service variable has been deleted.")->flash(); + Alert::success('That service variable has been deleted.')->flash(); } } catch (DisplayValidationException $ex) { return redirect()->route('admin.services.option.variables', $option)->withErrors(json_decode($ex->getMessage())); diff --git a/app/Http/Controllers/Admin/ServiceController.php b/app/Http/Controllers/Admin/ServiceController.php index 523e6bb14..bcf4d9008 100644 --- a/app/Http/Controllers/Admin/ServiceController.php +++ b/app/Http/Controllers/Admin/ServiceController.php @@ -149,16 +149,4 @@ class ServiceController extends Controller return redirect()->route($redirectTo, $id); } - - /** - * Edits function file for a service. - * - * @param Request $request - * @param int $id - * @return \Illuminate\Response\RedirectResponse - */ - public function editFunctions(Request $request, $id) - { - - } } diff --git a/app/Http/Controllers/Daemon/ServiceController.php b/app/Http/Controllers/Daemon/ServiceController.php index 6638f30d6..99d69cf02 100644 --- a/app/Http/Controllers/Daemon/ServiceController.php +++ b/app/Http/Controllers/Daemon/ServiceController.php @@ -66,7 +66,7 @@ class ServiceController extends Controller if ($file === 'index.js') { return response($service->index_file)->header('Content-Type', 'text/plain'); - } else if ($file === 'main.json') { + } elseif ($file === 'main.json') { return response()->json($this->getConfiguration($service->id)); } diff --git a/app/Models/Service.php b/app/Models/Service.php index c521b8035..96798f94c 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -51,7 +51,7 @@ class Service extends Model */ public function defaultIndexFile() { - return <<options as $option) { + foreach ($service->options as $option) { (new OptionRepository)->delete($option->id); } diff --git a/database/migrations/2017_03_10_162934_AddNewServiceOptionsColumns.php b/database/migrations/2017_03_10_162934_AddNewServiceOptionsColumns.php index 535c3b477..71af419b0 100644 --- a/database/migrations/2017_03_10_162934_AddNewServiceOptionsColumns.php +++ b/database/migrations/2017_03_10_162934_AddNewServiceOptionsColumns.php @@ -13,7 +13,7 @@ class AddNewServiceOptionsColumns extends Migration */ public function up() { - DB::transaction(function() { + DB::transaction(function () { Schema::table('service_options', function (Blueprint $table) { $table->dropColumn('executable'); @@ -35,7 +35,7 @@ class AddNewServiceOptionsColumns extends Migration */ public function down() { - DB::transaction(function() { + DB::transaction(function () { Schema::table('service_options', function (Blueprint $table) { $table->dropForeign('config_from'); diff --git a/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php b/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php index c22954150..75d775185 100644 --- a/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php +++ b/database/migrations/2017_03_10_173607_MigrateToNewServiceSystem.php @@ -23,8 +23,6 @@ */ use Pterodactyl\Models\Service; use Pterodactyl\Models\ServiceOption; -use Illuminate\Support\Facades\Schema; -use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class MigrateToNewServiceSystem extends Migration @@ -69,7 +67,7 @@ class MigrateToNewServiceSystem extends Migration DB::transaction(function () use ($service) { $options = ServiceOption::where('service_id', $service->id)->get(); $options->each(function ($item) use ($options) { - switch($item->tag) { + switch ($item->tag) { case 'vanilla': $item->config_startup = '{"done": ")! For help, type ", "userInteraction": [ "Go to eula.txt for more info."]}'; $item->config_files = '{"server.properties":{"parser": "properties", "find":{"server-ip": "0.0.0.0", "enable-query": "true", "server-port": "{{server.build.default.port}}", "query.port": "{{server.build.default.port}}"}}}'; @@ -117,13 +115,13 @@ class MigrateToNewServiceSystem extends Migration $options->each(function ($item) use ($options) { if ($item->tag === 'srcds' && $item->name === 'Insurgency') { $item->tag = 'insurgency'; - } else if ($item->tag === 'srcds' && $item->name === 'Team Fortress 2') { + } elseif ($item->tag === 'srcds' && $item->name === 'Team Fortress 2') { $item->tag = 'tf2'; - } else if ($item->tag === 'srcds' && $item->name === 'Custom Source Engine Game') { + } elseif ($item->tag === 'srcds' && $item->name === 'Custom Source Engine Game') { $item->tag = 'source'; } - switch($item->tag) { + switch ($item->tag) { case 'source': $item->config_startup = '{"done": "Assigned anonymous gameserver", "userInteraction": []}'; $item->config_files = '{}'; @@ -164,7 +162,7 @@ class MigrateToNewServiceSystem extends Migration DB::transaction(function () use ($service) { $options = ServiceOption::where('service_id', $service->id)->get(); $options->each(function ($item) use ($options) { - switch($item->tag) { + switch ($item->tag) { case 'tshock': $item->startup = null; $item->config_startup = '{"done": "Type \'help\' for a list of commands", "userInteraction": []}'; @@ -195,7 +193,7 @@ class MigrateToNewServiceSystem extends Migration DB::transaction(function () use ($service) { $options = ServiceOption::where('service_id', $service->id)->get(); $options->each(function ($item) use ($options) { - switch($item->tag) { + switch ($item->tag) { case 'mumble': $item->startup = './murmur.x86 -fg'; $item->config_startup = '{"done": "Server listening on", "userInteraction": [ "Generating new server certificate"]}'; diff --git a/database/migrations/2017_03_11_215455_ChangeServiceVariablesValidationRules.php b/database/migrations/2017_03_11_215455_ChangeServiceVariablesValidationRules.php index 1ade5b53e..a9c1dae84 100644 --- a/database/migrations/2017_03_11_215455_ChangeServiceVariablesValidationRules.php +++ b/database/migrations/2017_03_11_215455_ChangeServiceVariablesValidationRules.php @@ -19,7 +19,7 @@ class ChangeServiceVariablesValidationRules extends Migration }); DB::transaction(function () { - foreach(ServiceVariable::all() as $variable) { + foreach (ServiceVariable::all() as $variable) { $variable->rules = ($variable->required) ? 'required|regex:' . $variable->rules : 'regex:' . $variable->regex; $variable->save(); } @@ -38,7 +38,7 @@ class ChangeServiceVariablesValidationRules extends Migration }); DB::transaction(function () { - foreach(ServiceVariable::all() as $variable) { + foreach (ServiceVariable::all() as $variable) { $variable->regex = str_replace(['required|regex:', 'regex:'], '', $variable->regex); $variable->save(); } diff --git a/database/migrations/2017_03_12_150648_MoveFunctionsFromFileToDatabase.php b/database/migrations/2017_03_12_150648_MoveFunctionsFromFileToDatabase.php index bb37afd9a..b58051736 100644 --- a/database/migrations/2017_03_12_150648_MoveFunctionsFromFileToDatabase.php +++ b/database/migrations/2017_03_12_150648_MoveFunctionsFromFileToDatabase.php @@ -8,7 +8,7 @@ use Illuminate\Database\Migrations\Migration; class MoveFunctionsFromFileToDatabase extends Migration { - private $default = <<