Apply fixes from StyleCI
This commit is contained in:
parent
a1d3bbf73d
commit
c1fb0a665f
150 changed files with 1558 additions and 1760 deletions
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
|
||||
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -21,20 +21,17 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Repositories\ServiceRepository;
|
||||
|
||||
use DB;
|
||||
use Validator;
|
||||
|
||||
use Pterodactyl\Models;
|
||||
use Pterodactyl\Services\UuidService;
|
||||
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Exceptions\DisplayValidationException;
|
||||
|
||||
class Option
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
|
@ -50,7 +47,7 @@ class Option
|
|||
'tag' => 'required|string|max:255',
|
||||
'executable' => 'sometimes|string|max:255',
|
||||
'docker_image' => 'required|string|max:255',
|
||||
'startup' => 'sometimes|string'
|
||||
'startup' => 'sometimes|string',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
@ -105,7 +102,7 @@ class Option
|
|||
'tag' => 'sometimes|required|string|max:255',
|
||||
'executable' => 'sometimes|string|max:255',
|
||||
'docker_image' => 'sometimes|required|string|max:255',
|
||||
'startup' => 'sometimes|string'
|
||||
'startup' => 'sometimes|string',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
@ -123,5 +120,4 @@ class Option
|
|||
$option->fill($data);
|
||||
$option->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
|
||||
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -21,21 +21,18 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Repositories\ServiceRepository;
|
||||
|
||||
use DB;
|
||||
use Validator;
|
||||
use Uuid;
|
||||
|
||||
use Validator;
|
||||
use Pterodactyl\Models;
|
||||
use Pterodactyl\Services\UuidService;
|
||||
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Exceptions\DisplayValidationException;
|
||||
|
||||
class Service
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
|
@ -48,7 +45,7 @@ class Service
|
|||
'description' => 'required|string',
|
||||
'file' => 'required|regex:/^[\w.-]{1,50}$/',
|
||||
'executable' => 'max:255|regex:/^(.*)$/',
|
||||
'startup' => 'string'
|
||||
'startup' => 'string',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
@ -77,7 +74,7 @@ class Service
|
|||
'description' => 'sometimes|required|string',
|
||||
'file' => 'sometimes|required|regex:/^[\w.-]{1,50}$/',
|
||||
'executable' => 'sometimes|max:255|regex:/^(.*)$/',
|
||||
'startup' => 'sometimes|string'
|
||||
'startup' => 'sometimes|string',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
@ -109,5 +106,4 @@ class Service
|
|||
throw $ex;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>
|
||||
* Copyright (c) 2015 - 2016 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -21,20 +21,17 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Repositories\ServiceRepository;
|
||||
|
||||
use DB;
|
||||
use Validator;
|
||||
|
||||
use Pterodactyl\Models;
|
||||
use Pterodactyl\Services\UuidService;
|
||||
|
||||
use Pterodactyl\Exceptions\DisplayException;
|
||||
use Pterodactyl\Exceptions\DisplayValidationException;
|
||||
|
||||
class Variable
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
|
@ -52,14 +49,14 @@ class Variable
|
|||
'user_viewable' => 'sometimes|required|numeric|size:1',
|
||||
'user_editable' => 'sometimes|required|numeric|size:1',
|
||||
'required' => 'sometimes|required|numeric|size:1',
|
||||
'regex' => 'required|string|min:1'
|
||||
'regex' => 'required|string|min:1',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
throw new DisplayValidationException($validator->errors());
|
||||
}
|
||||
|
||||
if ($data['default_value'] !== '' && !preg_match($data['regex'], $data['default_value'])) {
|
||||
if ($data['default_value'] !== '' && ! preg_match($data['regex'], $data['default_value'])) {
|
||||
throw new DisplayException('The default value you entered cannot violate the regex requirements.');
|
||||
}
|
||||
|
||||
|
@ -77,7 +74,8 @@ class Variable
|
|||
$variable->save();
|
||||
}
|
||||
|
||||
public function delete($id) {
|
||||
public function delete($id)
|
||||
{
|
||||
$variable = Models\ServiceVariables::findOrFail($id);
|
||||
|
||||
DB::beginTransaction();
|
||||
|
@ -104,7 +102,7 @@ class Variable
|
|||
'user_viewable' => 'sometimes|required|numeric|boolean',
|
||||
'user_editable' => 'sometimes|required|numeric|boolean',
|
||||
'required' => 'sometimes|required|numeric|boolean',
|
||||
'regex' => 'sometimes|required|string|min:1'
|
||||
'regex' => 'sometimes|required|string|min:1',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
|
@ -114,7 +112,7 @@ class Variable
|
|||
$data['default_value'] = (isset($data['default_value'])) ? $data['default_value'] : $variable->default_value;
|
||||
$data['regex'] = (isset($data['regex'])) ? $data['regex'] : $variable->regex;
|
||||
|
||||
if ($data['default_value'] !== '' && !preg_match($data['regex'], $data['default_value'])) {
|
||||
if ($data['default_value'] !== '' && ! preg_match($data['regex'], $data['default_value'])) {
|
||||
throw new DisplayException('The default value you entered cannot violate the regex requirements.');
|
||||
}
|
||||
|
||||
|
@ -129,5 +127,4 @@ class Variable
|
|||
$variable->fill($data);
|
||||
$variable->save();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue