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

@ -15,7 +15,7 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
class BackupRemoteUploadController extends Controller
{
const PART_SIZE = 5 * 1024 * 1024 * 1024;
public const PART_SIZE = 5 * 1024 * 1024 * 1024;
/**
* @var \Pterodactyl\Repositories\Eloquent\BackupRepository
@ -29,9 +29,6 @@ class BackupRemoteUploadController extends Controller
/**
* BackupRemoteUploadController constructor.
*
* @param \Pterodactyl\Repositories\Eloquent\BackupRepository $repository
* @param \Pterodactyl\Extensions\Backups\BackupManager $backupManager
*/
public function __construct(BackupRepository $repository, BackupManager $backupManager)
{
@ -42,9 +39,6 @@ class BackupRemoteUploadController extends Controller
/**
* Returns the required presigned urls to upload a backup to S3 cloud storage.
*
* @param \Illuminate\Http\Request $request
* @param string $backup
*
* @return \Illuminate\Http\JsonResponse
*
* @throws \Exception
@ -64,13 +58,13 @@ class BackupRemoteUploadController extends Controller
// Prevent backups that have already been completed from trying to
// be uploaded again.
if (! is_null($backup->completed_at)) {
if (!is_null($backup->completed_at)) {
throw new ConflictHttpException('This backup is already in a completed state.');
}
// Ensure we are using the S3 adapter.
$adapter = $this->backupManager->adapter();
if (! $adapter instanceof AwsS3Adapter) {
if (!$adapter instanceof AwsS3Adapter) {
throw new BadRequestHttpException('The configured backup adapter is not an S3 compatible adapter.');
}
@ -97,9 +91,10 @@ class BackupRemoteUploadController extends Controller
// Create as many UploadPart presigned urls as needed
$parts = [];
for ($i = 0; $i < ($size / self::PART_SIZE); $i++) {
for ($i = 0; $i < ($size / self::PART_SIZE); ++$i) {
$parts[] = $client->createPresignedRequest(
$client->getCommand('UploadPart', array_merge($params, ['PartNumber' => $i + 1])), $expires
$client->getCommand('UploadPart', array_merge($params, ['PartNumber' => $i + 1])),
$expires
)->getUri()->__toString();
}