From 7c916ad38f04a0b9e1d5639e20fcf84c613192a2 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 12 Feb 2017 15:10:39 -0500 Subject: [PATCH] Apply fixes from StyleCI (#294) --- app/Http/Controllers/API/LocationController.php | 1 - app/Http/Controllers/API/NodeController.php | 2 +- app/Http/Controllers/API/User/InfoController.php | 1 - app/Http/Controllers/API/UserController.php | 1 - app/Http/Controllers/Admin/DatabaseController.php | 1 - app/Http/Controllers/Admin/LocationsController.php | 1 - app/Http/Controllers/Admin/PackController.php | 3 +-- app/Http/Controllers/Admin/ServersController.php | 2 -- app/Http/Controllers/Admin/ServiceController.php | 1 - app/Http/Controllers/Admin/UserController.php | 1 - app/Http/Controllers/Base/IndexController.php | 1 - app/Http/Controllers/Server/SubuserController.php | 1 - app/Models/Allocation.php | 4 ++-- app/Models/Permission.php | 3 +-- app/Models/ServiceVariables.php | 8 ++++---- app/Models/Subuser.php | 11 +++++------ app/Repositories/ServiceRepository/Pack.php | 2 -- app/Repositories/ServiceRepository/Variable.php | 2 +- app/Repositories/SubuserRepository.php | 6 ++---- app/Services/NotificationService.php | 1 - .../2017_02_09_174834_SetupPermissionsPivotTable.php | 8 ++++---- 21 files changed, 21 insertions(+), 40 deletions(-) diff --git a/app/Http/Controllers/API/LocationController.php b/app/Http/Controllers/API/LocationController.php index 94ec5fe7d..fcaf5a71c 100755 --- a/app/Http/Controllers/API/LocationController.php +++ b/app/Http/Controllers/API/LocationController.php @@ -24,7 +24,6 @@ namespace Pterodactyl\Http\Controllers\API; -use DB; use Illuminate\Http\Request; use Pterodactyl\Models\Location; diff --git a/app/Http/Controllers/API/NodeController.php b/app/Http/Controllers/API/NodeController.php index fd87770f7..ce76e4637 100755 --- a/app/Http/Controllers/API/NodeController.php +++ b/app/Http/Controllers/API/NodeController.php @@ -138,7 +138,7 @@ class NodeController extends BaseController $node->allocations->transform(function ($item) { return collect($item)->only([ - 'id', 'ip', 'ip_alias', 'port', 'server_id' + 'id', 'ip', 'ip_alias', 'port', 'server_id', ]); }); diff --git a/app/Http/Controllers/API/User/InfoController.php b/app/Http/Controllers/API/User/InfoController.php index 6ef84ce50..a22d1e114 100644 --- a/app/Http/Controllers/API/User/InfoController.php +++ b/app/Http/Controllers/API/User/InfoController.php @@ -24,7 +24,6 @@ namespace Pterodactyl\Http\Controllers\API\User; -use Pterodactyl\Models; use Illuminate\Http\Request; use Pterodactyl\Http\Controllers\API\BaseController; diff --git a/app/Http/Controllers/API/UserController.php b/app/Http/Controllers/API/UserController.php index 14c212f77..4121f64ef 100755 --- a/app/Http/Controllers/API/UserController.php +++ b/app/Http/Controllers/API/UserController.php @@ -31,7 +31,6 @@ use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Repositories\UserRepository; 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/Admin/DatabaseController.php b/app/Http/Controllers/Admin/DatabaseController.php index 1b7dcb5a2..7014c321b 100644 --- a/app/Http/Controllers/Admin/DatabaseController.php +++ b/app/Http/Controllers/Admin/DatabaseController.php @@ -24,7 +24,6 @@ namespace Pterodactyl\Http\Controllers\Admin; -use DB; use Log; use Alert; use Pterodactyl\Models; diff --git a/app/Http/Controllers/Admin/LocationsController.php b/app/Http/Controllers/Admin/LocationsController.php index 4f6343e5f..94c9ebf59 100644 --- a/app/Http/Controllers/Admin/LocationsController.php +++ b/app/Http/Controllers/Admin/LocationsController.php @@ -24,7 +24,6 @@ namespace Pterodactyl\Http\Controllers\Admin; -use DB; use Alert; use Pterodactyl\Models; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/Admin/PackController.php b/app/Http/Controllers/Admin/PackController.php index c86e2ada4..51cceea7f 100644 --- a/app/Http/Controllers/Admin/PackController.php +++ b/app/Http/Controllers/Admin/PackController.php @@ -24,7 +24,6 @@ namespace Pterodactyl\Http\Controllers\Admin; -use DB; use Log; use Alert; use Storage; @@ -50,7 +49,7 @@ class PackController extends Controller public function listByOption(Request $request, $id) { return view('admin.services.packs.byoption', [ - 'option' => Models\ServiceOptions::with('service', 'packs')->findOrFail($id) + 'option' => Models\ServiceOptions::with('service', 'packs')->findOrFail($id), ]); } diff --git a/app/Http/Controllers/Admin/ServersController.php b/app/Http/Controllers/Admin/ServersController.php index ab73937c4..8165262f5 100644 --- a/app/Http/Controllers/Admin/ServersController.php +++ b/app/Http/Controllers/Admin/ServersController.php @@ -24,7 +24,6 @@ namespace Pterodactyl\Http\Controllers\Admin; -use DB; use Log; use Alert; use Pterodactyl\Models; @@ -62,7 +61,6 @@ class ServersController extends Controller public function getView(Request $request, $id) { - $server = Models\Server::withTrashed()->with( 'user', 'option.variables', 'variables', 'node.allocations', 'databases.host' diff --git a/app/Http/Controllers/Admin/ServiceController.php b/app/Http/Controllers/Admin/ServiceController.php index 5aad76fd3..5309912ef 100644 --- a/app/Http/Controllers/Admin/ServiceController.php +++ b/app/Http/Controllers/Admin/ServiceController.php @@ -24,7 +24,6 @@ namespace Pterodactyl\Http\Controllers\Admin; -use DB; use Log; use Alert; use Storage; diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 5ebce1b42..8f90795c2 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -29,7 +29,6 @@ use Log; use Alert; use Illuminate\Http\Request; use Pterodactyl\Models\User; -use Pterodactyl\Models\Server; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Repositories\UserRepository; diff --git a/app/Http/Controllers/Base/IndexController.php b/app/Http/Controllers/Base/IndexController.php index e59ceb068..6b0bd273e 100644 --- a/app/Http/Controllers/Base/IndexController.php +++ b/app/Http/Controllers/Base/IndexController.php @@ -26,7 +26,6 @@ namespace Pterodactyl\Http\Controllers\Base; use Illuminate\Http\Request; -use Pterodactyl\Models\Server; use Pterodactyl\Http\Controllers\Controller; class IndexController extends Controller diff --git a/app/Http/Controllers/Server/SubuserController.php b/app/Http/Controllers/Server/SubuserController.php index 76735e351..a3ae8e3ba 100644 --- a/app/Http/Controllers/Server/SubuserController.php +++ b/app/Http/Controllers/Server/SubuserController.php @@ -24,7 +24,6 @@ namespace Pterodactyl\Http\Controllers\Server; -use DB; use Log; use Auth; use Alert; diff --git a/app/Models/Allocation.php b/app/Models/Allocation.php index 4799ebc98..aad98ac63 100644 --- a/app/Models/Allocation.php +++ b/app/Models/Allocation.php @@ -68,10 +68,10 @@ class Allocation extends Model * Accessor to quickly determine if this allocation has an alias. * * @param null|string $value - * @return boolean + * @return bool */ public function getHasAliasAttribute($value) { - return (! is_null($this->ip_alias)); + return ! is_null($this->ip_alias); } } diff --git a/app/Models/Permission.php b/app/Models/Permission.php index fe7221719..7dfd55f3f 100644 --- a/app/Models/Permission.php +++ b/app/Models/Permission.php @@ -28,11 +28,10 @@ use Illuminate\Database\Eloquent\Model; class Permission extends Model { - /** * Should timestamps be used on this model. * - * @var boolean + * @var bool */ public $timestamps = false; diff --git a/app/Models/ServiceVariables.php b/app/Models/ServiceVariables.php index f088202e7..3ad434bcc 100644 --- a/app/Models/ServiceVariables.php +++ b/app/Models/ServiceVariables.php @@ -54,8 +54,8 @@ class ServiceVariables extends Model 'required' => 'integer', ]; - public function serverVariables() - { - return $this->hasMany(ServerVariables::class, 'variable_id'); - } + public function serverVariables() + { + return $this->hasMany(ServerVariables::class, 'variable_id'); + } } diff --git a/app/Models/Subuser.php b/app/Models/Subuser.php index 25a82f615..15fc5cbea 100644 --- a/app/Models/Subuser.php +++ b/app/Models/Subuser.php @@ -24,7 +24,6 @@ namespace Pterodactyl\Models; -use Auth; use Illuminate\Database\Eloquent\Model; class Subuser extends Model @@ -50,11 +49,11 @@ class Subuser extends Model */ protected $guarded = ['id', 'created_at', 'updated_at']; - /** - * Cast values to correct type. - * - * @var array - */ + /** + * Cast values to correct type. + * + * @var array + */ protected $casts = [ 'user_id' => 'integer', 'server_id' => 'integer', diff --git a/app/Repositories/ServiceRepository/Pack.php b/app/Repositories/ServiceRepository/Pack.php index c3cc2dc9c..2132c4954 100644 --- a/app/Repositories/ServiceRepository/Pack.php +++ b/app/Repositories/ServiceRepository/Pack.php @@ -177,8 +177,6 @@ class Pack 'selectable' => isset($data['selectable']), 'visible' => isset($data['visible']), ]); - - return; } public function delete($id) diff --git a/app/Repositories/ServiceRepository/Variable.php b/app/Repositories/ServiceRepository/Variable.php index bc7ab4c13..7cb6d368c 100644 --- a/app/Repositories/ServiceRepository/Variable.php +++ b/app/Repositories/ServiceRepository/Variable.php @@ -80,7 +80,7 @@ class Variable DB::beginTransaction(); try { - foreach($variable->serverVariables as $svar) { + foreach ($variable->serverVariables as $svar) { $svar->delete(); } $variable->delete(); diff --git a/app/Repositories/SubuserRepository.php b/app/Repositories/SubuserRepository.php index 4e4691dda..2010a5aba 100644 --- a/app/Repositories/SubuserRepository.php +++ b/app/Repositories/SubuserRepository.php @@ -25,8 +25,6 @@ namespace Pterodactyl\Repositories; use DB; -use Mail; -use Settings; use Validator; use Pterodactyl\Models; use Pterodactyl\Services\UuidService; @@ -229,7 +227,7 @@ class SubuserRepository ], ]); - foreach($subuser->permissions as &$permission) { + foreach ($subuser->permissions as &$permission) { $permission->delete(); } $subuser->delete(); @@ -273,7 +271,7 @@ class SubuserRepository DB::beginTransaction(); try { - foreach($subuser->permissions as &$permission) { + foreach ($subuser->permissions as &$permission) { $permission->delete(); } diff --git a/app/Services/NotificationService.php b/app/Services/NotificationService.php index 53a6e0ff9..7912cf65d 100644 --- a/app/Services/NotificationService.php +++ b/app/Services/NotificationService.php @@ -24,7 +24,6 @@ namespace Pterodactyl\Services; -use Pterodactyl\Models\User; use Pterodactyl\Models\Server; use Pterodactyl\Notifications\Daemon; diff --git a/database/migrations/2017_02_09_174834_SetupPermissionsPivotTable.php b/database/migrations/2017_02_09_174834_SetupPermissionsPivotTable.php index ce5e3ae89..7194bf075 100644 --- a/database/migrations/2017_02_09_174834_SetupPermissionsPivotTable.php +++ b/database/migrations/2017_02_09_174834_SetupPermissionsPivotTable.php @@ -1,10 +1,10 @@ user_id)->where('server_id', $subuser->server_id)->update([ 'subuser_id' => $subuser->id, ]); @@ -55,7 +55,7 @@ class SetupPermissionsPivotTable extends Migration }); DB::transaction(function () { - foreach(Subuser::all() as &$subuser) { + foreach (Subuser::all() as &$subuser) { Permission::where('subuser_id', $subuser->id)->update([ 'user_id' => $subuser->user_id, 'server_id' => $subuser->server_id,