Use more standardized phpcs

This commit is contained in:
Dane Everitt 2021-01-23 12:33:34 -08:00
parent a043071e3c
commit c449ca5155
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
493 changed files with 1116 additions and 3903 deletions

View file

@ -20,8 +20,6 @@ trait CreatesTestModels
*
* The returned server model will have all of the relationships loaded onto it.
*
* @param array $attributes
*
* @return \Pterodactyl\Models\Server
*/
public function createServerModel(array $attributes = [])
@ -30,14 +28,14 @@ trait CreatesTestModels
$attributes['owner_id'] = $attributes['user_id'];
}
if (! isset($attributes['owner_id'])) {
if (!isset($attributes['owner_id'])) {
/** @var \Pterodactyl\Models\User $user */
$user = User::factory()->create();
$attributes['owner_id'] = $user->id;
}
if (! isset($attributes['node_id'])) {
if (! isset($attributes['location_id'])) {
if (!isset($attributes['node_id'])) {
if (!isset($attributes['location_id'])) {
/** @var \Pterodactyl\Models\Location $location */
$location = Location::factory()->create();
$attributes['location_id'] = $location->id;
@ -48,23 +46,23 @@ trait CreatesTestModels
$attributes['node_id'] = $node->id;
}
if (! isset($attributes['allocation_id'])) {
if (!isset($attributes['allocation_id'])) {
/** @var \Pterodactyl\Models\Allocation $allocation */
$allocation = Allocation::factory()->create(['node_id' => $attributes['node_id']]);
$attributes['allocation_id'] = $allocation->id;
}
if (! isset($attributes['nest_id'])) {
if (!isset($attributes['nest_id'])) {
/** @var \Pterodactyl\Models\Nest $nest */
$nest = Nest::with('eggs')->first();
$attributes['nest_id'] = $nest->id;
if (! isset($attributes['egg_id'])) {
if (!isset($attributes['egg_id'])) {
$attributes['egg_id'] = $nest->getRelation('eggs')->first()->id;
}
}
if (! isset($attributes['egg_id'])) {
if (!isset($attributes['egg_id'])) {
/** @var \Pterodactyl\Models\Egg $egg */
$egg = Egg::where('nest_id', $attributes['nest_id'])->first();
$attributes['egg_id'] = $egg->id;
@ -85,9 +83,6 @@ trait CreatesTestModels
/**
* Clones a given egg allowing us to make modifications that don't affect other
* tests that rely on the egg existing in the correct state.
*
* @param \Pterodactyl\Models\Egg $egg
* @return \Pterodactyl\Models\Egg
*/
protected function cloneEggAndVariables(Egg $egg): Egg
{