Skip to content

Commit

Permalink
Apply fixes from StyleCI (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyson239 committed Feb 6, 2020
1 parent 13ccd31 commit 36b1659
Show file tree
Hide file tree
Showing 20 changed files with 811 additions and 745 deletions.
108 changes: 56 additions & 52 deletions src/Actions/ManagesAllocations.php
Original file line number Diff line number Diff line change
@@ -1,52 +1,56 @@
<?php

namespace HCGCloud\Pterodactyl\Actions;

use HCGCloud\Pterodactyl\Resources\Allocation;

trait ManagesAllocations
{
/**
* Get the collection of allocations for a given node.
*
* @param integer $nodeId
* @return array
*/
public function allocations($nodeId, int $page = 1)
{
$data = $this->get("api/application/nodes/$nodeId" . "/allocations?page=" . $page);
$transform = $this->transformCollection(
$data['data'],
Allocation::class
);
return [
'data' => $transform,
'meta' => $data['meta']
];
}

/**
* Create new allocation(s).
*
* @param integer $nodeId
* @param array $data
* @return void
*/
public function createAllocation($nodeId, array $data)
{
return $this->post("api/application/nodes/$nodeId/allocations", $data);
}

/**
* Delete the given allocation.
*
* @param integer $nodeId
* @param integer $allocationId
* @param array $data
* @return void
*/
public function deleteAllocation($nodeId, $allocationId)
{
return $this->delete("api/application/nodes/$nodeId/allocations/$allocationId");
}
}
<?php

namespace HCGCloud\Pterodactyl\Actions;

use HCGCloud\Pterodactyl\Resources\Allocation;

trait ManagesAllocations
{
/**
* Get the collection of allocations for a given node.
*
* @param int $nodeId
*
* @return array
*/
public function allocations($nodeId, int $page = 1)
{
$data = $this->get("api/application/nodes/$nodeId".'/allocations?page='.$page);
$transform = $this->transformCollection(
$data['data'],
Allocation::class
);

return [
'data' => $transform,
'meta' => $data['meta'],
];
}

/**
* Create new allocation(s).
*
* @param int $nodeId
* @param array $data
*
* @return void
*/
public function createAllocation($nodeId, array $data)
{
return $this->post("api/application/nodes/$nodeId/allocations", $data);
}

/**
* Delete the given allocation.
*
* @param int $nodeId
* @param int $allocationId
* @param array $data
*
* @return void
*/
public function deleteAllocation($nodeId, $allocationId)
{
return $this->delete("api/application/nodes/$nodeId/allocations/$allocationId");
}
}
14 changes: 8 additions & 6 deletions src/Actions/ManagesEggs.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ trait ManagesEggs
{
/**
* Get a collection of eggs in a nest.
*
* @param integer $nestId
*
* @param int $nestId
*
* @return Egg[]
*/
public function eggs($nestId)
Expand All @@ -19,16 +20,17 @@ public function eggs($nestId)
Egg::class
);
}

/**
* Get a egg instance.
*
* @param integer $nestId
* @param integer $eggId
* @param int $nestId
* @param int $eggId
*
* @return Egg
*/
public function egg($nestId, $eggId)
{
return new Egg($this->get("api/application/nests/$nestId/eggs/$eggId"), $this);
return new Egg($this->get("api/application/nests/$nestId/eggs/$eggId"), $this);
}
}
23 changes: 14 additions & 9 deletions src/Actions/ManagesLocations.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,35 @@ trait ManagesLocations
*/
public function locations(int $page = 1)
{
$data = $this->get("api/application/locations?page=" . $page);
$data = $this->get('api/application/locations?page='.$page);
$transform = $this->transformCollection(
$data['data'],
Location::class
);

return [
'data' => $transform,
'meta' => $data['meta']
'meta' => $data['meta'],
];
}

/**
* Get a location instance.
*
* @param integer $locationId
* @param int $locationId
*
* @return Location
*/
public function location($locationId)
{
return new Location($this->get("api/application/locations/$locationId"), $this);
return new Location($this->get("api/application/locations/$locationId"), $this);
}

/**
* Create a new location.
*
* @param array $data
* @param array $data
*
* @return Location
*/
public function createLocation(array $data)
Expand All @@ -49,19 +52,21 @@ public function createLocation(array $data)
/**
* Update a specified location.
*
* @param integer $locationId
* @param array $data
* @param int $locationId
* @param array $data
*
* @return Location
*/
public function updateLocation($locationId, array $data)
{
return new Location($this->patch("api/application/locations/$locationId", $data), $this);
}

/**
* Delete the given location.
*
* @param integer $locationId
* @param int $locationId
*
* @return void
*/
public function deleteLocation($locationId)
Expand Down
12 changes: 7 additions & 5 deletions src/Actions/ManagesNests.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@ trait ManagesNests
*/
public function nests(int $page = 1)
{
$data = $this->get("api/application/nests?page=" . $page);
$data = $this->get('api/application/nests?page='.$page);
$transform = $this->transformCollection(
$data['data'],
Nest::class
);

return [
'data' => $transform,
'meta' => $data['meta']
'meta' => $data['meta'],
];
}

/**
* Get a nest instance.
*
* @param integer $nestId
* @param int $nestId
*
* @return Nest
*/
public function nest($nestId)
{
return new Nest($this->get("api/application/nests/$nestId"), $this);
return new Nest($this->get("api/application/nests/$nestId"), $this);
}
}
23 changes: 14 additions & 9 deletions src/Actions/ManagesNodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,35 @@ trait ManagesNodes
*/
public function nodes(int $page = 1)
{
$data = $this->get("api/application/nodes?page=" . $page);
$data = $this->get('api/application/nodes?page='.$page);
$transform = $this->transformCollection(
$data['data'],
Node::class
);

return [
'data' => $transform,
'meta' => $data['meta']
'meta' => $data['meta'],
];
}

/**
* Get a node instance.
*
* @param integer $nodeId
* @param int $nodeId
*
* @return Node
*/
public function node($nodeId)
{
return new Node($this->get("api/application/nodes/$nodeId"), $this);
return new Node($this->get("api/application/nodes/$nodeId"), $this);
}

/**
* Create a new node.
*
* @param array $data
* @param array $data
*
* @return Node
*/
public function createNode(array $data)
Expand All @@ -49,19 +52,21 @@ public function createNode(array $data)
/**
* Update a specified node.
*
* @param integer $nodeId
* @param array $data
* @param int $nodeId
* @param array $data
*
* @return Node
*/
public function updateNode($nodeId, array $data)
{
return new Node($this->patch("api/application/nodes/$nodeId", $data), $this);
}

/**
* Delete the given node.
*
* @param integer $nodeId
* @param int $nodeId
*
* @return void
*/
public function deleteNode($nodeId)
Expand Down
Loading

0 comments on commit 36b1659

Please sign in to comment.