From f0057353ad2fcfb285f390eec01e18d6250f154b Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 19 Mar 2017 23:52:11 +0000 Subject: [PATCH] Apply fixes from StyleCI --- app/Console/Commands/RebuildServer.php | 5 +++-- app/Http/Controllers/API/NodeController.php | 15 +++++++-------- app/Http/Controllers/API/ServerController.php | 1 - app/Http/Controllers/API/ServiceController.php | 1 - app/Http/Controllers/API/UserController.php | 1 - app/Http/Controllers/Admin/PackController.php | 1 - app/Models/User.php | 1 + app/Repositories/Daemon/CommandRepository.php | 1 - app/Repositories/ServerRepository.php | 2 +- app/Services/APILogService.php | 2 +- 10 files changed, 13 insertions(+), 17 deletions(-) diff --git a/app/Console/Commands/RebuildServer.php b/app/Console/Commands/RebuildServer.php index 7581a72a..2177b112 100644 --- a/app/Console/Commands/RebuildServer.php +++ b/app/Console/Commands/RebuildServer.php @@ -72,6 +72,7 @@ class RebuildServer extends Command $servers = Server::where('id', $this->option('server'))->get(); } else { $this->error('You must pass a flag to determine which server(s) to rebuild.'); + return; } @@ -80,7 +81,7 @@ class RebuildServer extends Command $this->line('Beginning processing, do not exit this script.'); $bar = $this->output->createProgressBar(count($servers)); $results = collect([]); - foreach($servers as $server) { + foreach ($servers as $server) { try { $environment = $server->option->variables->map(function ($item, $key) use ($server) { $display = $server->variables->where('variable_id', $item->id)->pluck('variable_value')->first(); @@ -136,7 +137,7 @@ class RebuildServer extends Command $this->line("\n"); $results->each(function ($item, $key) use ($console) { - foreach($item['messages'] as $line) { + foreach ($item['messages'] as $line) { $console->{$item['status']}($line); } }); diff --git a/app/Http/Controllers/API/NodeController.php b/app/Http/Controllers/API/NodeController.php index c0df9cba..6a03bdba 100755 --- a/app/Http/Controllers/API/NodeController.php +++ b/app/Http/Controllers/API/NodeController.php @@ -32,7 +32,6 @@ use Dingo\Api\Exception\ResourceException; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Repositories\NodeRepository; use Pterodactyl\Exceptions\DisplayValidationException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException; @@ -113,13 +112,13 @@ class NodeController extends BaseController return $node->toArray(); } - /** - * Returns a configuration file for a given node. - * - * @param Request $request - * @param int $id - * @return array - */ + /** + * Returns a configuration file for a given node. + * + * @param Request $request + * @param int $id + * @return array + */ public function config(Request $request, $id) { $node = Node::findOrFail($id); diff --git a/app/Http/Controllers/API/ServerController.php b/app/Http/Controllers/API/ServerController.php index 0e25c19a..2dae6bcd 100755 --- a/app/Http/Controllers/API/ServerController.php +++ b/app/Http/Controllers/API/ServerController.php @@ -31,7 +31,6 @@ use Dingo\Api\Exception\ResourceException; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Repositories\ServerRepository; use Pterodactyl\Exceptions\DisplayValidationException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException; diff --git a/app/Http/Controllers/API/ServiceController.php b/app/Http/Controllers/API/ServiceController.php index 9402f411..1916ef41 100755 --- a/app/Http/Controllers/API/ServiceController.php +++ b/app/Http/Controllers/API/ServiceController.php @@ -26,7 +26,6 @@ namespace Pterodactyl\Http\Controllers\API; use Illuminate\Http\Request; use Pterodactyl\Models\Service; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class ServiceController extends BaseController { diff --git a/app/Http/Controllers/API/UserController.php b/app/Http/Controllers/API/UserController.php index 1d35bcf4..981baef5 100755 --- a/app/Http/Controllers/API/UserController.php +++ b/app/Http/Controllers/API/UserController.php @@ -30,7 +30,6 @@ use Dingo\Api\Exception\ResourceException; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Repositories\UserRepository; use Pterodactyl\Exceptions\DisplayValidationException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException; class UserController extends BaseController diff --git a/app/Http/Controllers/Admin/PackController.php b/app/Http/Controllers/Admin/PackController.php index 9d1e6e76..14d248dc 100644 --- a/app/Http/Controllers/Admin/PackController.php +++ b/app/Http/Controllers/Admin/PackController.php @@ -202,7 +202,6 @@ class PackController extends Controller return response()->download($filename, 'pack-' . $pack->name . '.zip')->deleteFileAfterSend(true); } else { - $fp = fopen($filename, 'a+'); fwrite($fp, json_encode($json, JSON_PRETTY_PRINT)); fclose($fp); diff --git a/app/Models/User.php b/app/Models/User.php index 5dc828a3..9ec5b229 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -116,6 +116,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac } $this->use_totp = ! $this->use_totp; + return $this->save(); } diff --git a/app/Repositories/Daemon/CommandRepository.php b/app/Repositories/Daemon/CommandRepository.php index d14895b3..51afc610 100644 --- a/app/Repositories/Daemon/CommandRepository.php +++ b/app/Repositories/Daemon/CommandRepository.php @@ -25,7 +25,6 @@ namespace Pterodactyl\Repositories\Daemon; use Pterodactyl\Models; -use GuzzleHttp\Exception\RequestException; use Pterodactyl\Exceptions\DisplayException; class CommandRepository diff --git a/app/Repositories/ServerRepository.php b/app/Repositories/ServerRepository.php index a9ebf262..16d618ed 100644 --- a/app/Repositories/ServerRepository.php +++ b/app/Repositories/ServerRepository.php @@ -720,7 +720,7 @@ class ServerRepository } /** - * Queue a server for deletion + * Queue a server for deletion. * * @param int $id * @param bool $force diff --git a/app/Services/APILogService.php b/app/Services/APILogService.php index ce9fd56e..c8e5c098 100644 --- a/app/Services/APILogService.php +++ b/app/Services/APILogService.php @@ -31,7 +31,7 @@ use Pterodactyl\Models\APILog; class APILogService { /** - * Log an API Request + * Log an API Request. * * @param \Illuminate\Http\Request $request * @param null|string $error