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

@ -19,7 +19,6 @@ class DaemonBackupRepository extends DaemonRepository
/**
* Sets the backup adapter for this execution instance.
*
* @param string $adapter
* @return $this
*/
public function setBackupAdapter(string $adapter)
@ -32,9 +31,6 @@ class DaemonBackupRepository extends DaemonRepository
/**
* Tells the remote Daemon to begin generating a backup for the server.
*
* @param \Pterodactyl\Models\Backup $backup
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function backup(Backup $backup): ResponseInterface
@ -60,8 +56,6 @@ class DaemonBackupRepository extends DaemonRepository
/**
* Deletes a backup from the daemon.
*
* @param \Pterodactyl\Models\Backup $backup
* @return \Psr\Http\Message\ResponseInterface
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function delete(Backup $backup): ResponseInterface

View file

@ -14,7 +14,6 @@ class DaemonCommandRepository extends DaemonRepository
* Sends a command or multiple commands to a running server instance.
*
* @param string|string[] $command
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/

View file

@ -11,7 +11,6 @@ class DaemonConfigurationRepository extends DaemonRepository
/**
* Returns system information from the wings instance.
*
* @return array
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function getSystemInformation(): array
@ -30,15 +29,16 @@ class DaemonConfigurationRepository extends DaemonRepository
* this instance using a passed-in model. This allows us to change plenty of information
* in the model, and still use the old, pre-update model to actually make the HTTP request.
*
* @param \Pterodactyl\Models\Node $node
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function update(Node $node)
{
try {
return $this->getHttpClient()->post(
'/api/update', ['json' => $node->getConfiguration()]
'/api/update',
['json' => $node->getConfiguration()]
);
} catch (TransferException $exception) {
throw new DaemonConnectionException($exception);

View file

@ -14,9 +14,7 @@ class DaemonFileRepository extends DaemonRepository
/**
* Return the contents of a given file.
*
* @param string $path
* @param int|null $notLargerThan the maximum content length in bytes
* @return string
*
* @throws \GuzzleHttp\Exception\TransferException
* @throws \Pterodactyl\Exceptions\Http\Server\FileSizeTooLargeException
@ -40,7 +38,7 @@ class DaemonFileRepository extends DaemonRepository
$length = (int) $response->getHeader('Content-Length')[0] ?? 0;
if ($notLargerThan && $length > $notLargerThan) {
throw new FileSizeTooLargeException;
throw new FileSizeTooLargeException();
}
return $response->getBody()->__toString();
@ -50,10 +48,6 @@ class DaemonFileRepository extends DaemonRepository
* Save new contents to a given file. This works for both creating and updating
* a file.
*
* @param string $path
* @param string $content
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function putContent(string $path, string $content): ResponseInterface
@ -76,9 +70,6 @@ class DaemonFileRepository extends DaemonRepository
/**
* Return a directory listing for a given path.
*
* @param string $path
* @return array
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function getDirectory(string $path): array
@ -102,10 +93,6 @@ class DaemonFileRepository extends DaemonRepository
/**
* Creates a new directory for the server in the given $path.
*
* @param string $name
* @param string $path
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function createDirectory(string $name, string $path): ResponseInterface
@ -130,10 +117,6 @@ class DaemonFileRepository extends DaemonRepository
/**
* Renames or moves a file on the remote machine.
*
* @param string|null $root
* @param array $files
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function renameFiles(?string $root, array $files): ResponseInterface
@ -158,9 +141,6 @@ class DaemonFileRepository extends DaemonRepository
/**
* Copy a given file and give it a unique name.
*
* @param string $location
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function copyFile(string $location): ResponseInterface
@ -184,10 +164,6 @@ class DaemonFileRepository extends DaemonRepository
/**
* Delete a file or folder for the server.
*
* @param string|null $root
* @param array $files
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function deleteFiles(?string $root, array $files): ResponseInterface
@ -212,10 +188,6 @@ class DaemonFileRepository extends DaemonRepository
/**
* Compress the given files or folders in the given root.
*
* @param string|null $root
* @param array $files
* @return array
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function compressFiles(?string $root, array $files): array
@ -245,10 +217,6 @@ class DaemonFileRepository extends DaemonRepository
/**
* Decompresses a given archive file.
*
* @param string|null $root
* @param string $file
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function decompressFile(?string $root, string $file): ResponseInterface
@ -273,10 +241,6 @@ class DaemonFileRepository extends DaemonRepository
/**
* Chmods the given files.
*
* @param string|null $root
* @param array $files
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function chmodFiles(?string $root, array $files): ResponseInterface
@ -301,10 +265,6 @@ class DaemonFileRepository extends DaemonRepository
/**
* Pulls a file from the given URL and saves it to the disk.
*
* @param string $url
* @param string|null $directory
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function pull(string $url, ?string $directory): ResponseInterface

View file

@ -13,9 +13,6 @@ class DaemonPowerRepository extends DaemonRepository
/**
* Sends a power action to the server instance.
*
* @param string $action
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function send(string $action): ResponseInterface

View file

@ -27,8 +27,6 @@ abstract class DaemonRepository
/**
* BaseWingsRepository constructor.
*
* @param \Illuminate\Contracts\Foundation\Application $application
*/
public function __construct(Application $application)
{
@ -38,7 +36,6 @@ abstract class DaemonRepository
/**
* Set the server model this request is stemming from.
*
* @param \Pterodactyl\Models\Server $server
* @return $this
*/
public function setServer(Server $server)
@ -53,7 +50,6 @@ abstract class DaemonRepository
/**
* Set the node model this request is stemming from.
*
* @param \Pterodactyl\Models\Node $node
* @return $this
*/
public function setNode(Node $node)
@ -65,9 +61,6 @@ abstract class DaemonRepository
/**
* Return an instance of the Guzzle HTTP Client to be used for requests.
*
* @param array $headers
* @return \GuzzleHttp\Client
*/
public function getHttpClient(array $headers = []): Client
{

View file

@ -32,8 +32,6 @@ class DaemonServerRepository extends DaemonRepository
/**
* Creates a new server on the Wings daemon.
*
* @param array $data
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function create(array $data): void
@ -42,7 +40,8 @@ class DaemonServerRepository extends DaemonRepository
try {
$this->getHttpClient()->post(
'/api/servers', [
'/api/servers',
[
'json' => $data,
]
);
@ -54,8 +53,6 @@ class DaemonServerRepository extends DaemonRepository
/**
* Updates details about a server on the Daemon.
*
* @param array $data
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function update(array $data): void
@ -96,7 +93,8 @@ class DaemonServerRepository extends DaemonRepository
try {
$this->getHttpClient()->post(sprintf(
'/api/servers/%s/reinstall', $this->server->uuid
'/api/servers/%s/reinstall',
$this->server->uuid
));
} catch (TransferException $exception) {
throw new DaemonConnectionException($exception);
@ -107,8 +105,6 @@ class DaemonServerRepository extends DaemonRepository
* By default this function will suspend a server instance on the daemon. However, passing
* "true" as the first argument will unsuspend the server.
*
* @param bool $unsuspend
*
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function suspend(bool $unsuspend = false): void
@ -118,7 +114,7 @@ class DaemonServerRepository extends DaemonRepository
try {
$this->getHttpClient()->patch(
'/api/servers/' . $this->server->uuid,
['json' => ['suspended' => ! $unsuspend]]
['json' => ['suspended' => !$unsuspend]]
);
} catch (TransferException $exception) {
throw new DaemonConnectionException($exception);
@ -137,7 +133,8 @@ class DaemonServerRepository extends DaemonRepository
try {
$this->getHttpClient()->post(sprintf(
'/api/servers/%s/archive', $this->server->uuid
'/api/servers/%s/archive',
$this->server->uuid
));
} catch (TransferException $exception) {
throw new DaemonConnectionException($exception);
@ -149,7 +146,6 @@ class DaemonServerRepository extends DaemonRepository
* make it easier to revoke tokens on the fly. This ensures that the JTI key is formatted
* correctly and avoids any costly mistakes in the codebase.
*
* @param int $id
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
public function revokeUserJTI(int $id): void
@ -163,7 +159,6 @@ class DaemonServerRepository extends DaemonRepository
* Revokes an array of JWT JTI's by marking any token generated before the current time on
* the Wings instance as being invalid.
*
* @param array $jtis
* @throws \Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException
*/
protected function revokeJTIs(array $jtis): void

View file

@ -10,11 +10,6 @@ use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException;
class DaemonTransferRepository extends DaemonRepository
{
/**
* @param Server $server
* @param array $data
* @param Node $node
* @param string $token
*
* @throws DaemonConnectionException
*/
public function notify(Server $server, array $data, Node $node, string $token): void