1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-25 10:32:31 +01:00

Apply fixes from StyleCI

[ci skip] [skip ci]
This commit is contained in:
Dane Everitt 2018-06-02 21:32:26 +00:00 committed by StyleCI Bot
parent 3078b61ac6
commit 969b16a563
9 changed files with 30 additions and 39 deletions

View File

@ -202,7 +202,7 @@ interface RepositoryInterface
public function insertIgnore(array $values): bool;
/**
* Get the amount of entries in the database
* Get the amount of entries in the database.
*
* @return int
*/

View File

@ -147,7 +147,7 @@ interface ServerRepositoryInterface extends RepositoryInterface, SearchableInter
public function isUniqueUuidCombo(string $uuid, string $short): bool;
/**
* Get the amount of servers that are suspended
* Get the amount of servers that are suspended.
*
* @return int
*/

View File

@ -2,16 +2,14 @@
namespace Pterodactyl\Http\Controllers\Admin;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Http\Controllers\Controller;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Traits\Controllers\PlainJavascriptInjection;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
class StatisticsController extends Controller
{
@ -29,15 +27,14 @@ class StatisticsController extends Controller
private $userRepository;
function __construct(
public function __construct(
AllocationRepositoryInterface $allocationRepository,
DatabaseRepositoryInterface $databaseRepository,
EggRepositoryInterface $eggRepository,
NodeRepositoryInterface $nodeRepository,
ServerRepositoryInterface $serverRepository,
UserRepositoryInterface $userRepository
)
{
) {
$this->allocationRepository = $allocationRepository;
$this->databaseRepository = $databaseRepository;
$this->eggRepository = $eggRepository;
@ -83,7 +80,7 @@ class StatisticsController extends Controller
'nodes' => $nodes,
'tokens' => $tokens,
]);
return view('admin.statistics', [
'servers' => $servers,
'nodes' => $nodes,
@ -97,5 +94,4 @@ class StatisticsController extends Controller
'totalAllocations' => $totalAllocations,
]);
}
}

View File

@ -2,7 +2,6 @@
namespace Pterodactyl\Http;
use Pterodactyl\Http\Middleware\MaintenanceMiddleware;
use Pterodactyl\Models\ApiKey;
use Illuminate\Auth\Middleware\Authorize;
use Illuminate\Auth\Middleware\Authenticate;
@ -21,6 +20,7 @@ use Illuminate\Routing\Middleware\SubstituteBindings;
use Pterodactyl\Http\Middleware\AccessingValidServer;
use Pterodactyl\Http\Middleware\Api\SetSessionDriver;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use Pterodactyl\Http\Middleware\MaintenanceMiddleware;
use Pterodactyl\Http\Middleware\RedirectIfAuthenticated;
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
use Pterodactyl\Http\Middleware\Api\AuthenticateIPAccess;

View File

@ -298,7 +298,7 @@ abstract class EloquentRepository extends Repository implements RepositoryInterf
}
/**
* Get the amount of entries in the database
* Get the amount of entries in the database.
*
* @return int
*/

View File

@ -330,7 +330,7 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
}
/**
* Get the amount of servers that are suspended
* Get the amount of servers that are suspended.
*
* @return int
*/

View File

@ -3,7 +3,7 @@
* Created by PhpStorm.
* User: Stan
* Date: 26-5-2018
* Time: 20:56
* Time: 20:56.
*/
namespace Pterodactyl\Traits\Controllers;
@ -12,13 +12,11 @@ use JavaScript;
trait PlainJavascriptInjection
{
/**
* Injects statistics into javascript
* Injects statistics into javascript.
*/
public function injectJavascript($data)
{
Javascript::put($data);
}
}
}

View File

@ -14,7 +14,7 @@ class AddMaintenanceToNodes extends Migration
public function up()
{
Schema::table('nodes', function (Blueprint $table) {
$table->boolean('maintenance_mode')->after('behind_proxy')->default(false);
$table->boolean('maintenance_mode')->after('behind_proxy')->default(false);
});
}
@ -26,7 +26,7 @@ class AddMaintenanceToNodes extends Migration
public function down()
{
Schema::table('nodes', function (Blueprint $table) {
$table->dropColumn('maintenance_mode');
$table->dropColumn('maintenance_mode');
});
}
}

View File

@ -3,24 +3,22 @@
* Created by PhpStorm.
* User: Stan
* Date: 26-5-2018
* Time: 21:06
* Time: 21:06.
*/
namespace Tests\Unit\Http\Controllers\Admin;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Routing\Controller;
use Mockery as m;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Http\Controllers\Admin\StatisticsController;
use Pterodactyl\Models\Node;
use Tests\Assertions\ControllerAssertionsTrait;
use Tests\Unit\Http\Controllers\ControllerTestCase;
use Pterodactyl\Contracts\Repository\EggRepositoryInterface;
use Pterodactyl\Http\Controllers\Admin\StatisticsController;
use Pterodactyl\Contracts\Repository\NodeRepositoryInterface;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
use Pterodactyl\Contracts\Repository\ServerRepositoryInterface;
use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface;
class StatisticsControllerTest extends ControllerTestCase
{
@ -88,7 +86,7 @@ class StatisticsControllerTest extends ControllerTestCase
'disk' => [
'value' => 1024,
'max' => 512,
]
],
]);
$controller->shouldReceive('injectJavascript')->once();
@ -106,8 +104,7 @@ class StatisticsControllerTest extends ControllerTestCase
$this->eggRepository,
$this->nodeRepository,
$this->serverRepository,
$this->userRepository]
$this->userRepository, ]
);
}
}
}