diff --git a/src/Ploi/Resources/App.php b/src/Ploi/Resources/App.php index a39d12c..9eb1187 100644 --- a/src/Ploi/Resources/App.php +++ b/src/Ploi/Resources/App.php @@ -4,6 +4,7 @@ namespace Ploi\Resources; use Ploi\Exceptions\Http\NotValid; +use Ploi\Http\Response; use stdClass; class App extends Resource @@ -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); diff --git a/src/Ploi/Resources/Database.php b/src/Ploi/Resources/Database.php index 5a925db..4aa21b4 100644 --- a/src/Ploi/Resources/Database.php +++ b/src/Ploi/Resources/Database.php @@ -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); @@ -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 diff --git a/src/Ploi/Resources/FileBackup.php b/src/Ploi/Resources/FileBackup.php index eb82a88..17b0768 100644 --- a/src/Ploi/Resources/FileBackup.php +++ b/src/Ploi/Resources/FileBackup.php @@ -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); @@ -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); @@ -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); @@ -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); @@ -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); diff --git a/src/Ploi/Resources/Opcache.php b/src/Ploi/Resources/Opcache.php index 5f2542f..56b7cbd 100644 --- a/src/Ploi/Resources/Opcache.php +++ b/src/Ploi/Resources/Opcache.php @@ -3,6 +3,8 @@ namespace Ploi\Resources; +use Ploi\Http\Response; + class Opcache extends Resource { public function __construct(Server $server, ?int $id = null) @@ -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'); diff --git a/src/Ploi/Resources/Server.php b/src/Ploi/Resources/Server.php index 66acf85..5934ed5 100644 --- a/src/Ploi/Resources/Server.php +++ b/src/Ploi/Resources/Server.php @@ -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); } diff --git a/src/Ploi/Resources/Site.php b/src/Ploi/Resources/Site.php index 05bc170..82e1e71 100644 --- a/src/Ploi/Resources/Site.php +++ b/src/Ploi/Resources/Site.php @@ -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); @@ -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); } @@ -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); } @@ -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); } diff --git a/src/Ploi/Resources/Synchronize.php b/src/Ploi/Resources/Synchronize.php index 2f7b164..1b034a7 100644 --- a/src/Ploi/Resources/Synchronize.php +++ b/src/Ploi/Resources/Synchronize.php @@ -3,6 +3,7 @@ namespace Ploi\Resources; +use Ploi\Http\Response; use Ploi\Ploi; class Synchronize extends Resource @@ -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'); }