Apply fixes from StyleCI (#372)

This commit is contained in:
Dane Everitt 2017-04-09 19:16:39 -04:00 committed by GitHub
parent 7bd14db646
commit 93d79994f8
22 changed files with 43 additions and 32 deletions

View File

@ -4,7 +4,6 @@ namespace Pterodactyl\Exceptions;
use Log; use Log;
use Exception; use Exception;
use DisplayException;
use Illuminate\Auth\AuthenticationException; use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

View File

@ -27,8 +27,8 @@ namespace Pterodactyl\Http\Controllers\API\Admin;
use Fractal; use Fractal;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\Node; use Pterodactyl\Models\Node;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Repositories\NodeRepository; use Pterodactyl\Repositories\NodeRepository;
use Pterodactyl\Transformers\Admin\NodeTransformer; use Pterodactyl\Transformers\Admin\NodeTransformer;
use Pterodactyl\Exceptions\DisplayValidationException; use Pterodactyl\Exceptions\DisplayValidationException;
@ -135,6 +135,7 @@ class NodeController extends Controller
], 400); ], 400);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to create this node. Please try again.', 'error' => 'An unhandled exception occured while attemping to create this node. Please try again.',
], 500); ], 500);
@ -163,6 +164,7 @@ class NodeController extends Controller
], 400); ], 400);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to delete this node. Please try again.', 'error' => 'An unhandled exception occured while attemping to delete this node. Please try again.',
], 500); ], 500);

View File

@ -113,11 +113,13 @@ class ServerController extends Controller
], 400); ], 400);
} catch (TransferException $ex) { } catch (TransferException $ex) {
Log::warning($ex); Log::warning($ex);
return response()->json([ return response()->json([
'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.', 'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.',
], 504); ], 504);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to add this server. Please try again.', 'error' => 'An unhandled exception occured while attemping to add this server. Please try again.',
], 500); ], 500);
@ -146,11 +148,13 @@ class ServerController extends Controller
], 400); ], 400);
} catch (TransferException $ex) { } catch (TransferException $ex) {
Log::warning($ex); Log::warning($ex);
return response()->json([ return response()->json([
'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.', 'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.',
], 504); ], 504);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to add this server. Please try again.', 'error' => 'An unhandled exception occured while attemping to add this server. Please try again.',
], 500); ], 500);
@ -190,6 +194,7 @@ class ServerController extends Controller
], 400); ], 400);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to modify this server. Please try again.', 'error' => 'An unhandled exception occured while attemping to modify this server. Please try again.',
], 500); ], 500);
@ -223,11 +228,13 @@ class ServerController extends Controller
], 400); ], 400);
} catch (TransferException $ex) { } catch (TransferException $ex) {
Log::warning($ex); Log::warning($ex);
return response()->json([ return response()->json([
'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.', 'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.',
], 504); ], 504);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to modify this server container. Please try again.', 'error' => 'An unhandled exception occured while attemping to modify this server container. Please try again.',
], 500); ], 500);
@ -256,6 +263,7 @@ class ServerController extends Controller
], 400); ], 400);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to toggle the install status for this server. Please try again.', 'error' => 'An unhandled exception occured while attemping to toggle the install status for this server. Please try again.',
], 500); ], 500);
@ -283,6 +291,7 @@ class ServerController extends Controller
return response('', 204); return response('', 204);
} catch (TransferException $ex) { } catch (TransferException $ex) {
Log::warning($ex); Log::warning($ex);
return response()->json([ return response()->json([
'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.', 'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.',
], 504); ], 504);
@ -318,11 +327,13 @@ class ServerController extends Controller
], 400); ], 400);
} catch (TransferException $ex) { } catch (TransferException $ex) {
Log::warning($ex); Log::warning($ex);
return response()->json([ return response()->json([
'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.', 'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.',
], 504); ], 504);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to ' . $action . ' this server. Please try again.', 'error' => 'An unhandled exception occured while attemping to ' . $action . ' this server. Please try again.',
], 500); ], 500);
@ -363,11 +374,13 @@ class ServerController extends Controller
], 400); ], 400);
} catch (TransferException $ex) { } catch (TransferException $ex) {
Log::warning($ex); Log::warning($ex);
return response()->json([ return response()->json([
'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.', 'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.',
], 504); ], 504);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to modify the build settings for this server. Please try again.', 'error' => 'An unhandled exception occured while attemping to modify the build settings for this server. Please try again.',
], 500); ], 500);
@ -400,11 +413,13 @@ class ServerController extends Controller
], 400); ], 400);
} catch (TransferException $ex) { } catch (TransferException $ex) {
Log::warning($ex); Log::warning($ex);
return response()->json([ return response()->json([
'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.', 'error' => 'A TransferException was encountered while trying to contact the daemon, please ensure it is online and accessible. This error has been logged.',
], 504); ], 504);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to modify the startup settings for this server. Please try again.', 'error' => 'An unhandled exception occured while attemping to modify the startup settings for this server. Please try again.',
], 500); ], 500);

View File

@ -27,8 +27,8 @@ namespace Pterodactyl\Http\Controllers\API\Admin;
use Fractal; use Fractal;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Repositories\UserRepository; use Pterodactyl\Repositories\UserRepository;
use Pterodactyl\Transformers\Admin\UserTransformer; use Pterodactyl\Transformers\Admin\UserTransformer;
use Pterodactyl\Exceptions\DisplayValidationException; use Pterodactyl\Exceptions\DisplayValidationException;
@ -109,6 +109,7 @@ class UserController extends Controller
], 400); ], 400);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to create this user. Please try again.', 'error' => 'An unhandled exception occured while attemping to create this user. Please try again.',
], 500); ], 500);
@ -145,6 +146,7 @@ class UserController extends Controller
], 400); ], 400);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to update this user. Please try again.', 'error' => 'An unhandled exception occured while attemping to update this user. Please try again.',
], 500); ], 500);
@ -173,6 +175,7 @@ class UserController extends Controller
], 400); ], 400);
} catch (\Exception $ex) { } catch (\Exception $ex) {
Log::error($ex); Log::error($ex);
return response()->json([ return response()->json([
'error' => 'An unhandled exception occured while attemping to delete this user. Please try again.', 'error' => 'An unhandled exception occured while attemping to delete this user. Please try again.',
], 500); ], 500);

View File

@ -27,10 +27,9 @@ namespace Pterodactyl\Http\Controllers\API\User;
use Fractal; use Fractal;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use GuzzleHttp\Exception\ConnectException;
use Pterodactyl\Http\Controllers\Controller; use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Transformers\User\ServerTransformer;
use Pterodactyl\Repositories\Daemon\PowerRepository; use Pterodactyl\Repositories\Daemon\PowerRepository;
use Pterodactyl\Transformers\User\ServerTransformer;
class ServerController extends Controller class ServerController extends Controller
{ {

View File

@ -124,6 +124,6 @@ class CheckServer
} }
} }
return ($this->server->installed === 1); return $this->server->installed === 1;
} }
} }

View File

@ -28,13 +28,11 @@ use Auth;
use Crypt; use Crypt;
use Config; use Config;
use Closure; use Closure;
use Response;
use Debugbar; use Debugbar;
use IPTools\IP; use IPTools\IP;
use IPTools\Range; use IPTools\Range;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\APIKey; use Pterodactyl\Models\APIKey;
use Pterodactyl\Models\APIPermission;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; // 400 use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; // 400
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; // 403 use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; // 403
@ -194,7 +192,8 @@ class HMACAuthorization
* *
* @return string * @return string
*/ */
protected function public() { protected function public()
{
return $this->token['public']; return $this->token['public'];
} }
@ -203,7 +202,8 @@ class HMACAuthorization
* *
* @return string * @return string
*/ */
protected function hash() { protected function hash()
{
return $this->token['hash']; return $this->token['hash'];
} }
@ -212,7 +212,8 @@ class HMACAuthorization
* *
* @return \Pterodactyl\Models\APIKey * @return \Pterodactyl\Models\APIKey
*/ */
protected function key() { protected function key()
{
return $this->key; return $this->key;
} }

View File

@ -71,7 +71,7 @@ class APIPermission extends Model
'view', 'view',
'power', 'power',
'command', 'command',
] ],
], ],
// All other pemissions below are administrative actions. // All other pemissions below are administrative actions.
@ -120,7 +120,7 @@ class APIPermission extends Model
]; ];
/** /**
* Return permissions for API * Return permissions for API.
* *
* @return array * @return array
*/ */

View File

@ -209,7 +209,8 @@ class Server extends Model
* *
* @return array * @return array
*/ */
public function getTableColumns() { public function getTableColumns()
{
return Schema::getColumnListing($this->getTable()); return Schema::getColumnListing($this->getTable());
} }

View File

@ -31,8 +31,8 @@ use Validator;
use IPTools\Network; use IPTools\Network;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Models\APIKey as Key; use Pterodactyl\Models\APIKey as Key;
use Pterodactyl\Models\APIPermission as Permission;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Models\APIPermission as Permission;
use Pterodactyl\Exceptions\DisplayValidationException; use Pterodactyl\Exceptions\DisplayValidationException;
class APIRepository class APIRepository

View File

@ -147,7 +147,7 @@ class UserRepository
unset($data['password']); unset($data['password']);
} }
$user->fill($data)->save();; $user->fill($data)->save();
return $user; return $user;
} }

View File

@ -25,8 +25,8 @@
namespace Pterodactyl\Transformers\Admin; namespace Pterodactyl\Transformers\Admin;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Pterodactyl\Models\ServiceVariable;
use League\Fractal\TransformerAbstract; use League\Fractal\TransformerAbstract;
use Pterodactyl\Models\ServiceVariable;
class ServiceVariableTransformer extends TransformerAbstract class ServiceVariableTransformer extends TransformerAbstract
{ {

View File

@ -32,7 +32,7 @@ return [
'nodes' => env('APP_PAGINATE_API_NODES', 25), 'nodes' => env('APP_PAGINATE_API_NODES', 25),
'servers' => env('APP_PAGINATE_API_SERVERS', 25), 'servers' => env('APP_PAGINATE_API_SERVERS', 25),
'users' => env('APP_PAGINATE_API_USERS', 25), 'users' => env('APP_PAGINATE_API_USERS', 25),
] ],
], ],
/* /*

View File

@ -21,7 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
Route::get('/', 'BaseController@getIndex')->name('admin.index'); Route::get('/', 'BaseController@getIndex')->name('admin.index');
/* /*

View File

@ -21,10 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
Route::get('/', 'CoreController@index'); Route::get('/', 'CoreController@index');
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Server Controller Routes | Server Controller Routes

View File

@ -21,7 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
Route::get('/', 'CoreController@index')->name('api.user'); Route::get('/', 'CoreController@index')->name('api.user');
/* /*

View File

@ -21,7 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
Route::get('/logout', 'LoginController@logout')->name('auth.logout')->middleware('auth'); Route::get('/logout', 'LoginController@logout')->name('auth.logout')->middleware('auth');
Route::get('/login', 'LoginController@showLoginForm')->name('auth.login'); Route::get('/login', 'LoginController@showLoginForm')->name('auth.login');
Route::get('/login/totp', 'LoginController@totp')->name('auth.totp'); Route::get('/login/totp', 'LoginController@totp')->name('auth.totp');

View File

@ -21,7 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
Route::get('/', 'IndexController@getIndex')->name('index'); Route::get('/', 'IndexController@getIndex')->name('index');
Route::get('/index', function () { Route::get('/index', function () {
redirect()->route('index'); redirect()->route('index');

View File

@ -21,7 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
Route::get('/services', 'ServiceController@list')->name('daemon.services'); Route::get('/services', 'ServiceController@list')->name('daemon.services');
Route::get('/services/pull/{service}/{file}', 'ServiceController@pull')->name('daemon.pull'); Route::get('/services/pull/{service}/{file}', 'ServiceController@pull')->name('daemon.pull');
Route::get('/packs/pull/{uuid}', 'PackController@pull')->name('daemon.pack.pull'); Route::get('/packs/pull/{uuid}', 'PackController@pull')->name('daemon.pack.pull');

View File

@ -21,7 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
Route::get('/configuration/{token}', 'RemoteController@getConfiguration')->name('remote.configuration'); Route::get('/configuration/{token}', 'RemoteController@getConfiguration')->name('remote.configuration');
Route::post('/download', 'RemoteController@postDownload')->name('remote.download'); Route::post('/download', 'RemoteController@postDownload')->name('remote.download');

View File

@ -21,7 +21,6 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
*/ */
Route::get('/', 'ServerController@getIndex')->name('server.index'); Route::get('/', 'ServerController@getIndex')->name('server.index');
/* /*