Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Ploi/Resources/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace Ploi\Resources;

use Ploi\Exceptions\Http\NotValid;
use Ploi\Http\Response;
use stdClass;

class App extends Resource
Expand All @@ -29,7 +30,7 @@ public function buildEndpoint(): self
return $this;
}

public function get(?int $id = null)
public function get(?int $id = null): Response
{
if ($id) {
$this->setId($id);
Expand Down
6 changes: 3 additions & 3 deletions src/Ploi/Resources/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function get(?int $id = null): Response
: $this->getPloi()->makeAPICall($this->getEndpoint());
}

public function create(string $name, string $user, string $password, $description = null, $siteId = null): Response
public function create(string $name, string $user, string $password, ?string $description = null, ?int $siteId = null): Response
{
// Remove the id
$this->setId(null);
Expand Down Expand Up @@ -139,9 +139,9 @@ public function duplicate(string $name, ?string $user = null, ?string $password
return $this->getPloi()->makeAPICall($this->getEndpoint() . '/duplicate', 'post', $options);
}

public function backups($id = null): DatabaseBackup
public function backups(?int $id = null): DatabaseBackup
{
return new DatabaseBackup($this->getServer(),$this,$id);
return new DatabaseBackup($this->getServer(), $this, $id);
}

public function users(?int $id = null): DatabaseUser
Expand Down
20 changes: 10 additions & 10 deletions src/Ploi/Resources/FileBackup.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class FileBackup extends Resource
{
use HasPagination;

public function __construct(\Ploi\Ploi $ploi, int $id = null)
public function __construct(\Ploi\Ploi $ploi, ?int $id = null)
{
parent::__construct($ploi, $id);

Expand Down Expand Up @@ -38,7 +38,7 @@ public function buildEndpoint(): self
* @param int|null $id
* @return Response
*/
public function get(int $id = null): Response
public function get(?int $id = null): Response
{
if ($id) {
$this->setId($id);
Expand Down Expand Up @@ -72,12 +72,12 @@ public function create(
array $sites,
int $interval,
array $path,
string $locations = null,
int $keep_backup_amount = null,
string $custom_name = null,
string $password = null,
?bool $deleteOnFail = null
): Response {
?string $locations = null,
?int $keep_backup_amount = null,
?string $custom_name = null,
?string $password = null,
?bool $deleteOnFail = null
): Response {
// Remove the id
$this->setId(null);

Expand Down Expand Up @@ -109,7 +109,7 @@ public function create(
* @param int|null $id
* @return Response
*/
public function run(int $id = null): Response
public function run(?int $id = null): Response
{
$this->setIdOrFail($id);

Expand All @@ -125,7 +125,7 @@ public function run(int $id = null): Response
* @param int|null $id
* @return Response
*/
public function delete(int $id = null): Response
public function delete(?int $id = null): Response
{
$this->setIdOrFail($id);

Expand Down
8 changes: 5 additions & 3 deletions src/Ploi/Resources/Opcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

namespace Ploi\Resources;

use Ploi\Http\Response;

class Opcache extends Resource
{
public function __construct(Server $server, ?int $id = null)
Expand All @@ -25,21 +27,21 @@ public function buildEndpoint(): self
return $this;
}

public function refresh()
public function refresh(): Response
{
$this->setEndpoint($this->getEndpoint() . '/refresh-opcache');

return $this->getPloi()->makeAPICall($this->getEndpoint(), 'post');
}

public function enable()
public function enable(): Response
{
$this->setEndpoint($this->getEndpoint() . '/enable-opcache');

return $this->getPloi()->makeAPICall($this->getEndpoint(), 'post');
}

public function disable()
public function disable(): Response
{
$this->setEndpoint($this->getEndpoint() . '/disable-opcache');

Expand Down
2 changes: 1 addition & 1 deletion src/Ploi/Resources/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function monitoring(?int $id = null): Response
return $this->callApi('monitor');
}

public function sites($id = null): Site
public function sites(?int $id = null): Site
{
return new Site($this, $id);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Ploi/Resources/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(Server $server, ?int $id = null)
$this->buildEndpoint();
}

public function get(?int $id = null)
public function get(?int $id = null): Response
{
if ($id) {
$this->setId($id);
Expand Down Expand Up @@ -271,12 +271,12 @@ public function resetPermissions(?int $id = null): Response
return $this->getPloi()->makeAPICall($this->getEndpoint() . '/permission-reset', 'post');
}

public function redirects($id = null): Redirect
public function redirects(?int $id = null): Redirect
{
return new Redirect($this->getServer(), $this, $id);
}

public function certificates($id = null): Certificate
public function certificates(?int $id = null): Certificate
{
return new Certificate($this->getServer(), $this, $id);
}
Expand All @@ -286,7 +286,7 @@ public function repository(): Repository
return new Repository($this->getServer(), $this);
}

public function queues($id = null): Queue
public function queues(?int $id = null): Queue
{
return new Queue($this->getServer(), $this, $id);
}
Expand All @@ -296,7 +296,7 @@ public function deployment(): Deployment
return new Deployment($this->getServer(), $this);
}

public function app($id = null): App
public function app(?int $id = null): App
{
return new App($this->getServer(), $this, $id);
}
Expand Down
3 changes: 2 additions & 1 deletion src/Ploi/Resources/Synchronize.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

namespace Ploi\Resources;

use Ploi\Http\Response;
use Ploi\Ploi;

class Synchronize extends Resource
Expand All @@ -16,7 +17,7 @@ public function __construct(?Ploi $ploi = null, ?int $id = null)
$this->setEndpoint($this->endpoint);
}

public function servers()
public function servers(): Response
{
return $this->getPloi()->makeAPICall($this->getEndpoint() . '/servers');
}
Expand Down