Use more standardized phpcs
This commit is contained in:
parent
a043071e3c
commit
c449ca5155
493 changed files with 1116 additions and 3903 deletions
|
@ -18,8 +18,6 @@ class AllocationTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
@ -29,7 +27,6 @@ class AllocationTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic transformed allocation array.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Allocation $allocation)
|
||||
|
@ -40,43 +37,47 @@ class AllocationTransformer extends BaseTransformer
|
|||
'alias' => $allocation->ip_alias,
|
||||
'port' => $allocation->port,
|
||||
'notes' => $allocation->notes,
|
||||
'assigned' => ! is_null($allocation->server_id),
|
||||
'assigned' => !is_null($allocation->server_id),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the node relationship onto a given transformation.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeNode(Allocation $allocation)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_NODES)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_NODES)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
return $this->item(
|
||||
$allocation->node, $this->makeTransformer(NodeTransformer::class), Node::RESOURCE_NAME
|
||||
$allocation->node,
|
||||
$this->makeTransformer(NodeTransformer::class),
|
||||
Node::RESOURCE_NAME
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the server relationship onto a given transformation.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Allocation $allocation
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeServer(Allocation $allocation)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_SERVERS) || ! $allocation->server) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_SERVERS) || !$allocation->server) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
return $this->item(
|
||||
$allocation->server, $this->makeTransformer(ServerTransformer::class), Server::RESOURCE_NAME
|
||||
$allocation->server,
|
||||
$this->makeTransformer(ServerTransformer::class),
|
||||
Server::RESOURCE_NAME
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ use Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException;
|
|||
*/
|
||||
abstract class BaseTransformer extends TransformerAbstract
|
||||
{
|
||||
const RESPONSE_TIMEZONE = 'UTC';
|
||||
public const RESPONSE_TIMEZONE = 'UTC';
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Models\ApiKey
|
||||
|
@ -24,8 +24,6 @@ abstract class BaseTransformer extends TransformerAbstract
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getResourceName(): string;
|
||||
|
||||
|
@ -43,7 +41,6 @@ abstract class BaseTransformer extends TransformerAbstract
|
|||
/**
|
||||
* Set the HTTP request class being used for this request.
|
||||
*
|
||||
* @param \Pterodactyl\Models\ApiKey $key
|
||||
* @return $this
|
||||
*/
|
||||
public function setKey(ApiKey $key)
|
||||
|
@ -55,8 +52,6 @@ abstract class BaseTransformer extends TransformerAbstract
|
|||
|
||||
/**
|
||||
* Return the request instance being used for this transformer.
|
||||
*
|
||||
* @return \Pterodactyl\Models\ApiKey
|
||||
*/
|
||||
public function getKey(): ApiKey
|
||||
{
|
||||
|
@ -67,9 +62,6 @@ abstract class BaseTransformer extends TransformerAbstract
|
|||
* Determine if the API key loaded onto the transformer has permission
|
||||
* to access a different resource. This is used when including other
|
||||
* models on a transformation request.
|
||||
*
|
||||
* @param string $resource
|
||||
* @return bool
|
||||
*/
|
||||
protected function authorize(string $resource): bool
|
||||
{
|
||||
|
@ -80,8 +72,6 @@ abstract class BaseTransformer extends TransformerAbstract
|
|||
* Create a new instance of the transformer and pass along the currently
|
||||
* set API key.
|
||||
*
|
||||
* @param string $abstract
|
||||
* @param array $parameters
|
||||
* @return \Pterodactyl\Transformers\Api\Application\BaseTransformer
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
|
@ -92,7 +82,7 @@ abstract class BaseTransformer extends TransformerAbstract
|
|||
$transformer = Container::getInstance()->makeWith($abstract, $parameters);
|
||||
$transformer->setKey($this->getKey());
|
||||
|
||||
if (! $transformer instanceof self) {
|
||||
if (!$transformer instanceof self) {
|
||||
throw new InvalidTransformerLevelException('Calls to ' . __METHOD__ . ' must return a transformer that is an instance of ' . __CLASS__);
|
||||
}
|
||||
|
||||
|
@ -101,9 +91,6 @@ abstract class BaseTransformer extends TransformerAbstract
|
|||
|
||||
/**
|
||||
* Return an ISO-8601 formatted timestamp to use in the API response.
|
||||
*
|
||||
* @param string $timestamp
|
||||
* @return string
|
||||
*/
|
||||
protected function formatTimestamp(string $timestamp): string
|
||||
{
|
||||
|
|
|
@ -17,8 +17,6 @@ class DatabaseHostTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
@ -28,7 +26,6 @@ class DatabaseHostTransformer extends BaseTransformer
|
|||
/**
|
||||
* Transform database host into a representation for the application API.
|
||||
*
|
||||
* @param \Pterodactyl\Models\DatabaseHost $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(DatabaseHost $model)
|
||||
|
@ -48,13 +45,13 @@ class DatabaseHostTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include the databases associated with this host.
|
||||
*
|
||||
* @param \Pterodactyl\Models\DatabaseHost $model
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeDatabases(DatabaseHost $model)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,6 @@ class EggTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
@ -33,7 +31,6 @@ class EggTransformer extends BaseTransformer
|
|||
* Transform an Egg model into a representation that can be consumed by
|
||||
* the application api.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Egg $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Egg $model)
|
||||
|
@ -74,13 +71,13 @@ class EggTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include the Nest relationship for the given Egg in the transformation.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Egg $model
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeNest(Egg $model)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_NESTS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_NESTS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -92,13 +89,13 @@ class EggTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include the Servers relationship for the given Egg in the transformation.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Egg $model
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeServers(Egg $model)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -111,7 +108,6 @@ class EggTransformer extends BaseTransformer
|
|||
* Include more detailed information about the configuration if this Egg is
|
||||
* extending another.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Egg $model
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*/
|
||||
public function includeConfig(Egg $model)
|
||||
|
@ -136,7 +132,6 @@ class EggTransformer extends BaseTransformer
|
|||
* Include more detailed information about the script configuration if the
|
||||
* Egg is extending another.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Egg $model
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*/
|
||||
public function includeScript(Egg $model)
|
||||
|
@ -160,13 +155,13 @@ class EggTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include the variables that are defined for this Egg.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Egg $model
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeVariables(Egg $model)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,8 +9,6 @@ class EggVariableTransformer extends BaseTransformer
|
|||
{
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
|
|
@ -16,8 +16,6 @@ class LocationTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
@ -26,9 +24,6 @@ class LocationTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return a generic transformed location array.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Location $location): array
|
||||
{
|
||||
|
@ -44,14 +39,13 @@ class LocationTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return the nodes associated with this location.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeServers(Location $location)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -63,14 +57,13 @@ class LocationTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return the nodes associated with this location.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Location $location
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeNodes(Location $location)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_NODES)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_NODES)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ class NestTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
@ -32,7 +30,6 @@ class NestTransformer extends BaseTransformer
|
|||
* Transform a Nest model into a representation that can be consumed by the
|
||||
* application API.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Nest $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Nest $model)
|
||||
|
@ -48,14 +45,13 @@ class NestTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include the Eggs relationship on the given Nest model transformation.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Nest $model
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeEggs(Nest $model)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -67,14 +63,13 @@ class NestTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include the servers relationship on the given Nest model.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Nest $model
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeServers(Nest $model)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
|
|
@ -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'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,6 @@ class ServerDatabaseTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Perform dependency injection.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
||||
*/
|
||||
public function handle(Encrypter $encrypter)
|
||||
{
|
||||
|
@ -31,8 +29,6 @@ class ServerDatabaseTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
@ -41,9 +37,6 @@ class ServerDatabaseTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Transform a database model in a representation for the application API.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Database $model
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Database $model): array
|
||||
{
|
||||
|
@ -63,7 +56,6 @@ class ServerDatabaseTransformer extends BaseTransformer
|
|||
/**
|
||||
* Include the database password in the request.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Database $model
|
||||
* @return \League\Fractal\Resource\Item
|
||||
*/
|
||||
public function includePassword(Database $model)
|
||||
|
@ -78,13 +70,13 @@ class ServerDatabaseTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return the database host relationship for this server database.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Database $model
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeHost(Database $model)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_DATABASE_HOSTS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_DATABASE_HOSTS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,8 +33,6 @@ class ServerTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Perform dependency injection.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Servers\EnvironmentService $environmentService
|
||||
*/
|
||||
public function handle(EnvironmentService $environmentService)
|
||||
{
|
||||
|
@ -43,8 +41,6 @@ class ServerTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
@ -53,9 +49,6 @@ class ServerTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return a generic transformed server array.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Server $server): array
|
||||
{
|
||||
|
@ -99,14 +92,13 @@ class ServerTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic array of allocations for this server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeAllocations(Server $server)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_ALLOCATIONS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -118,14 +110,13 @@ class ServerTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic array of data about subusers for this server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeSubusers(Server $server)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_USERS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_USERS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -137,14 +128,13 @@ class ServerTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic array of data about subusers for this server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeUser(Server $server)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_USERS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_USERS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -156,14 +146,13 @@ class ServerTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic array with nest information for this server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeNest(Server $server)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_NESTS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_NESTS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -175,14 +164,13 @@ class ServerTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic array with egg information for this server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeEgg(Server $server)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -194,14 +182,13 @@ class ServerTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic array of data about subusers for this server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeVariables(Server $server)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -213,14 +200,13 @@ class ServerTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic array with location information for this server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeLocation(Server $server)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_LOCATIONS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_LOCATIONS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -232,14 +218,13 @@ class ServerTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic array with node information for this server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeNode(Server $server)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_NODES)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_NODES)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -251,14 +236,13 @@ class ServerTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic array with database information for this server.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Server $server
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeDatabases(Server $server)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_SERVER_DATABASES)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@ class ServerVariableTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
@ -27,7 +25,6 @@ class ServerVariableTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic transformed server variable array.
|
||||
*
|
||||
* @param \Pterodactyl\Models\EggVariable $variable
|
||||
* @return array
|
||||
*/
|
||||
public function transform(EggVariable $variable)
|
||||
|
@ -38,13 +35,13 @@ class ServerVariableTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return the parent service variable data.
|
||||
*
|
||||
* @param \Pterodactyl\Models\EggVariable $variable
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeParent(EggVariable $variable)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_EGGS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@ class SubuserTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
@ -26,9 +24,6 @@ class SubuserTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return a transformed Subuser model that can be consumed by external services.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return array
|
||||
*/
|
||||
public function transform(Subuser $subuser): array
|
||||
{
|
||||
|
@ -45,14 +40,13 @@ class SubuserTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic item of user for this subuser.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeUser(Subuser $subuser)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_USERS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_USERS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
@ -64,14 +58,13 @@ class SubuserTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return a generic item of server for this subuser.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Subuser $subuser
|
||||
* @return \League\Fractal\Resource\Item|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeServer(Subuser $subuser)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@ class UserTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return the resource name for the JSONAPI output.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getResourceName(): string
|
||||
{
|
||||
|
@ -26,9 +24,6 @@ class UserTransformer extends BaseTransformer
|
|||
|
||||
/**
|
||||
* Return a transformed User model that can be consumed by external services.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return array
|
||||
*/
|
||||
public function transform(User $user): array
|
||||
{
|
||||
|
@ -51,14 +46,13 @@ class UserTransformer extends BaseTransformer
|
|||
/**
|
||||
* Return the servers associated with this user.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @return \League\Fractal\Resource\Collection|\League\Fractal\Resource\NullResource
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Transformer\InvalidTransformerLevelException
|
||||
*/
|
||||
public function includeServers(User $user)
|
||||
{
|
||||
if (! $this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
if (!$this->authorize(AdminAcl::RESOURCE_SERVERS)) {
|
||||
return $this->null();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue