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

@ -16,8 +16,6 @@ class NodeTransformer extends BaseTransformer
/**
* Return the resource name for the JSONAPI output.
*
* @return string
*/
public function getResourceName(): string
{
@ -27,9 +25,6 @@ class NodeTransformer extends BaseTransformer
/**
* Return a node transformed into a format that can be consumed by the
* external administrative API.
*
* @param \Pterodactyl\Models\Node $node
* @return array
*/
public function transform(Node $node): array
{
@ -57,60 +52,66 @@ class NodeTransformer extends BaseTransformer
/**
* Return the nodes associated with this location.
*
* @param \Pterodactyl\Models\Node $node
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
*
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
*/
public function includeAllocations(Node $node)
{
if (! $this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) {
if (!$this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) {
return $this->null();
}
$node->loadMissing('allocations');
return $this->collection(
$node->getRelation('allocations'), $this->makeTransformer(AllocationTransformer::class), 'allocation'
$node->getRelation('allocations'),
$this->makeTransformer(AllocationTransformer::class),
'allocation'
);
}
/**
* Return the nodes associated with this location.
*
* @param \Pterodactyl\Models\Node $node
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
*
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
*/
public function includeLocation(Node $node)
{
if (! $this->authorize(AdminAcl::RESOURCE_LOCATIONS)) {
if (!$this->authorize(AdminAcl::RESOURCE_LOCATIONS)) {
return $this->null();
}
$node->loadMissing('location');
return $this->item(
$node->getRelation('location'), $this->makeTransformer(LocationTransformer::class), 'location'
$node->getRelation('location'),
$this->makeTransformer(LocationTransformer::class),
'location'
);
}
/**
* Return the nodes associated with this location.
*
* @param \Pterodactyl\Models\Node $node
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
*
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
*/
public function includeServers(Node $node)
{
if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) {
if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) {
return $this->null();
}
$node->loadMissing('servers');
return $this->collection(
$node->getRelation('servers'), $this->makeTransformer(ServerTransformer::class), 'server'
$node->getRelation('servers'),
$this->makeTransformer(ServerTransformer::class),
'server'
);
}
}