From 432e28b6bbb985ea62aec5a2a0d9da22ba1e0903 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sat, 11 Apr 2020 14:07:40 -0600 Subject: [PATCH] Fix all StyleCI errors and probably break everything in the process --- .../Environment/EmailSettingsCommand.php | 4 ++-- .../Controllers/Admin/DatabaseController.php | 1 + .../Client/Servers/ScheduleTaskController.php | 2 +- .../Remote/Servers/ServerBackupController.php | 2 -- app/Services/Nodes/NodeUpdateService.php | 1 - config/ide-helper.php | 4 ++-- database/factories/ModelFactory.php | 2 +- ...angeServicesToUseAMoreUniqueIdentifier.php | 4 ++-- ..._merge_permissions_table_into_subusers.php | 4 ++-- ...2020_04_03_230614_create_backups_table.php | 4 ++-- ...4_store_node_tokens_as_encrypted_value.php | 4 ++-- .../Services/Packs/PackUpdateServiceTest.php | 20 +++++++++---------- 12 files changed, 25 insertions(+), 27 deletions(-) diff --git a/app/Console/Commands/Environment/EmailSettingsCommand.php b/app/Console/Commands/Environment/EmailSettingsCommand.php index b8604757..add1296e 100644 --- a/app/Console/Commands/Environment/EmailSettingsCommand.php +++ b/app/Console/Commands/Environment/EmailSettingsCommand.php @@ -65,14 +65,14 @@ class EmailSettingsCommand extends Command public function handle() { $this->variables['MAIL_DRIVER'] = $this->option('driver') ?? $this->choice( - trans('command/messages.environment.mail.ask_driver'), [ + trans('command/messages.environment.mail.ask_driver'), [ 'smtp' => 'SMTP Server', 'mail' => 'PHP\'s Internal Mail Function', 'mailgun' => 'Mailgun Transactional Email', 'mandrill' => 'Mandrill Transactional Email', 'postmark' => 'Postmarkapp Transactional Email', ], $this->config->get('mail.driver', 'smtp') - ); + ); $method = 'setup' . studly_case($this->variables['MAIL_DRIVER']) . 'DriverVariables'; if (method_exists($this, $method)) { diff --git a/app/Http/Controllers/Admin/DatabaseController.php b/app/Http/Controllers/Admin/DatabaseController.php index 569fec1d..0aee8680 100644 --- a/app/Http/Controllers/Admin/DatabaseController.php +++ b/app/Http/Controllers/Admin/DatabaseController.php @@ -165,6 +165,7 @@ class DatabaseController extends Controller $this->alert->danger( sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage()) )->flash(); + return $redirect->withInput($request->normalize()); } else { throw $exception; diff --git a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php index 340e2541..7461a950 100644 --- a/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php +++ b/app/Http/Controllers/Api/Client/Servers/ScheduleTaskController.php @@ -86,7 +86,7 @@ class ScheduleTaskController extends ClientApiController } $this->repository->update($task->id, [ - 'action' => $request->input('action'), + 'action' => $request->input('action'), 'payload' => $request->input('payload'), 'time_offset' => $request->input('time_offset'), ]); diff --git a/app/Http/Controllers/Api/Remote/Servers/ServerBackupController.php b/app/Http/Controllers/Api/Remote/Servers/ServerBackupController.php index b4599ee0..8daee56a 100644 --- a/app/Http/Controllers/Api/Remote/Servers/ServerBackupController.php +++ b/app/Http/Controllers/Api/Remote/Servers/ServerBackupController.php @@ -3,8 +3,6 @@ namespace Pterodactyl\Http\Controllers\Api\Remote\Servers; use Carbon\Carbon; -use Illuminate\Http\Request; -use Pterodactyl\Models\Server; use Illuminate\Http\JsonResponse; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Repositories\Eloquent\BackupRepository; diff --git a/app/Services/Nodes/NodeUpdateService.php b/app/Services/Nodes/NodeUpdateService.php index 8ce610df..f2fb76be 100644 --- a/app/Services/Nodes/NodeUpdateService.php +++ b/app/Services/Nodes/NodeUpdateService.php @@ -8,7 +8,6 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use Illuminate\Database\ConnectionInterface; use Illuminate\Contracts\Encryption\Encrypter; -use Pterodactyl\Repositories\Daemon\ConfigurationRepository; use Pterodactyl\Contracts\Repository\NodeRepositoryInterface; use Pterodactyl\Repositories\Wings\DaemonConfigurationRepository; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; diff --git a/config/ide-helper.php b/config/ide-helper.php index 9f10873f..5922f533 100644 --- a/config/ide-helper.php +++ b/config/ide-helper.php @@ -168,8 +168,8 @@ return [ | Cast the given "real type" to the given "type". | */ - 'type_overrides' => [ + 'type_overrides' => [ 'integer' => 'int', 'boolean' => 'bool', - ], + ], ]; diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index 3b2d3e72..93fbac55 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -3,8 +3,8 @@ use Ramsey\Uuid\Uuid; use Cake\Chronos\Chronos; use Illuminate\Support\Str; -use Faker\Generator as Faker; use Pterodactyl\Models\Node; +use Faker\Generator as Faker; use Pterodactyl\Models\ApiKey; /* diff --git a/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php b/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php index 6bb36813..dffa7687 100644 --- a/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php +++ b/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php @@ -26,8 +26,8 @@ class ChangeServicesToUseAMoreUniqueIdentifier extends Migration DB::table('services')->get(['id', 'author', 'uuid'])->each(function ($service) { DB::table('services')->where('id', $service->id)->update([ - 'author' => ($service->author === 'ptrdctyl-v040-11e6-8b77-86f30ca893d3') ? 'support@pterodactyl.io' : 'unknown@unknown-author.com', - 'uuid' => Uuid::uuid4()->toString(), + 'author' => ($service->author === 'ptrdctyl-v040-11e6-8b77-86f30ca893d3') ? 'support@pterodactyl.io' : 'unknown@unknown-author.com', + 'uuid' => Uuid::uuid4()->toString(), ]); }); diff --git a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php index 7cd0c5fc..621c9526 100644 --- a/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php +++ b/database/migrations/2020_03_22_163911_merge_permissions_table_into_subusers.php @@ -44,12 +44,12 @@ class MergePermissionsTableIntoSubusers extends Migration { foreach (DB::select('SELECT id, permissions FROM subusers') as $datum) { $values = []; - foreach(json_decode($datum->permissions, true) as $permission) { + foreach (json_decode($datum->permissions, true) as $permission) { $values[] = $datum->id; $values[] = $permission; } - if (!empty($values)) { + if (! empty($values)) { $string = 'VALUES ' . implode(', ', array_fill(0, count($values) / 2, '(?, ?)')); DB::insert('INSERT INTO permissions(`subuser_id`, `permission`) ' . $string, $values); diff --git a/database/migrations/2020_04_03_230614_create_backups_table.php b/database/migrations/2020_04_03_230614_create_backups_table.php index 63dad39a..ead68105 100644 --- a/database/migrations/2020_04_03_230614_create_backups_table.php +++ b/database/migrations/2020_04_03_230614_create_backups_table.php @@ -1,8 +1,8 @@ make(); $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [ - 'locked' => false, - 'visible' => false, - 'selectable' => false, - 'test-data' => 'value', - ])->once()->andReturn(1); + 'locked' => false, + 'visible' => false, + 'selectable' => false, + 'test-data' => 'value', + ])->once()->andReturn(1); $this->assertEquals(1, $this->service->handle($model, ['test-data' => 'value'])); } @@ -88,11 +88,11 @@ class PackUpdateServiceTest extends TestCase $this->repository->shouldReceive('setColumns')->with(['id', 'egg_id'])->once()->andReturnSelf() ->shouldReceive('find')->with($model->id)->once()->andReturn($model); $this->repository->shouldReceive('withoutFreshModel->update')->with($model->id, [ - 'locked' => false, - 'visible' => false, - 'selectable' => false, - 'test-data' => 'value', - ])->once()->andReturn(1); + 'locked' => false, + 'visible' => false, + 'selectable' => false, + 'test-data' => 'value', + ])->once()->andReturn(1); $this->assertEquals(1, $this->service->handle($model->id, ['test-data' => 'value'])); }