Skip to content

Commit

Permalink
Merge pull request #111 from netgen/run-cs-fixer
Browse files Browse the repository at this point in the history
Run cs fixer
  • Loading branch information
RandyCupic authored Sep 11, 2024
2 parents f12be89 + a39c261 commit 1c44f2a
Show file tree
Hide file tree
Showing 46 changed files with 105 additions and 113 deletions.
2 changes: 1 addition & 1 deletion bundle/Controller/Callback/Cloudinary/Notify.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private function handleResourceRenamed(array $requestContent): void
->getQuery()
->getResult();

/** @var \Netgen\RemoteMedia\API\Values\RemoteResource $resource */
/** @var RemoteResource $resource */
foreach ($result as $resource) {
try {
$apiResource = Uploader::explicit(
Expand Down
2 changes: 1 addition & 1 deletion bundle/Controller/Facets/Load.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function __invoke(Request $request): Response

$formattedFolders = [];

/** @var \Netgen\RemoteMedia\API\Values\Folder $folder */
/** @var Folder $folder */
foreach ($folders as $folder) {
$formattedFolders[] = [
'id' => $folder->getPath(),
Expand Down
2 changes: 1 addition & 1 deletion bundle/Controller/Folder/Load.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __invoke(Request $request): Response
$folders = $this->provider->listFolders($parent);
$formattedFolders = [];

/** @var \Netgen\RemoteMedia\API\Values\Folder $folder */
/** @var Folder $folder */
foreach ($folders as $folder) {
$formattedFolders[] = [
'id' => $folder->getPath(),
Expand Down
3 changes: 2 additions & 1 deletion bundle/Controller/Resource/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Netgen\RemoteMedia\API\Values\Folder;
use Netgen\RemoteMedia\API\Values\RemoteResource;
use Netgen\RemoteMedia\Exception\RemoteResourceExistsException;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -72,7 +73,7 @@ public function __invoke(Request $request): Response
);
}

/** @var \Symfony\Component\HttpFoundation\File\UploadedFile $file */
/** @var UploadedFile $file */
$file = $request->files->get('file');

if (!$file->isFile()) {
Expand Down
3 changes: 2 additions & 1 deletion lib/API/Factory/RemoteResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
namespace Netgen\RemoteMedia\API\Factory;

use Netgen\RemoteMedia\API\Values\RemoteResource as RemoteResourceValue;
use Netgen\RemoteMedia\Exception\Factory\InvalidDataException;

interface RemoteResource
{
/**
* @throws \Netgen\RemoteMedia\Exception\Factory\InvalidDataException
* @throws InvalidDataException
*/
public function create(mixed $data): RemoteResourceValue;
}
3 changes: 2 additions & 1 deletion lib/API/Factory/SearchResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
namespace Netgen\RemoteMedia\API\Factory;

use Netgen\RemoteMedia\API\Search\Result;
use Netgen\RemoteMedia\Exception\Factory\InvalidDataException;

interface SearchResult
{
/**
* @throws \Netgen\RemoteMedia\Exception\Factory\InvalidDataException
* @throws InvalidDataException
*/
public function create(mixed $data): Result;
}
32 changes: 19 additions & 13 deletions lib/API/ProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
use Netgen\RemoteMedia\API\Values\RemoteResourceLocation;
use Netgen\RemoteMedia\API\Values\RemoteResourceVariation;
use Netgen\RemoteMedia\API\Values\StatusData;
use Netgen\RemoteMedia\Exception\NamedRemoteResourceLocationNotFoundException;
use Netgen\RemoteMedia\Exception\NamedRemoteResourceNotFoundException;
use Netgen\RemoteMedia\Exception\NotSupportedException;
use Netgen\RemoteMedia\Exception\RemoteResourceExistsException;
use Netgen\RemoteMedia\Exception\RemoteResourceLocationNotFoundException;
use Netgen\RemoteMedia\Exception\RemoteResourceNotFoundException;

interface ProviderInterface
{
Expand All @@ -34,12 +40,12 @@ public function getSupportedTypes(): array;
public function getSupportedVisibilities(): array;

/**
* @throws \Netgen\RemoteMedia\Exception\NotSupportedException
* @throws NotSupportedException
*/
public function listFolders(?Folder $parent = null): array;

/**
* @throws \Netgen\RemoteMedia\Exception\NotSupportedException
* @throws NotSupportedException
*/
public function createFolder(string $name, ?Folder $parent = null): Folder;

Expand All @@ -48,22 +54,22 @@ public function count(): int;
public function countInFolder(Folder $folder): int;

/**
* @throws \Netgen\RemoteMedia\Exception\NotSupportedException
* @throws NotSupportedException
*/
public function listTags(): array;

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceNotFoundException
* @throws RemoteResourceNotFoundException
*/
public function load(int $id): RemoteResource;

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceNotFoundException
* @throws RemoteResourceNotFoundException
*/
public function loadByRemoteId(string $remoteId): RemoteResource;

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceNotFoundException
* @throws RemoteResourceNotFoundException
*/
public function loadFromRemote(string $remoteId): RemoteResource;

Expand All @@ -74,7 +80,7 @@ public function remove(RemoteResource $resource): void;
public function deleteFromRemote(RemoteResource $resource): void;

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceLocationNotFoundException
* @throws RemoteResourceLocationNotFoundException
*/
public function loadLocation(int $id): RemoteResourceLocation;

Expand All @@ -83,14 +89,14 @@ public function storeLocation(RemoteResourceLocation $location): RemoteResourceL
public function removeLocation(RemoteResourceLocation $resourceLocation): void;

/**
* @throws \Netgen\RemoteMedia\Exception\NamedRemoteResourceNotFoundException
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceNotFoundException
* @throws NamedRemoteResourceNotFoundException
* @throws RemoteResourceNotFoundException
*/
public function loadNamedRemoteResource(string $name): RemoteResource;

/**
* @throws \Netgen\RemoteMedia\Exception\NamedRemoteResourceLocationNotFoundException
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceNotFoundException
* @throws NamedRemoteResourceLocationNotFoundException
* @throws RemoteResourceNotFoundException
*/
public function loadNamedRemoteResourceLocation(string $name): RemoteResourceLocation;

Expand All @@ -99,12 +105,12 @@ public function search(Query $query): Result;
public function searchCount(Query $query): int;

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceExistsException
* @throws RemoteResourceExistsException
*/
public function upload(ResourceStruct $resourceStruct): RemoteResource;

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceNotFoundException
* @throws RemoteResourceNotFoundException
*/
public function updateOnRemote(RemoteResource $resource): void;

Expand Down
3 changes: 1 addition & 2 deletions lib/API/Search/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public function __construct(
private int $limit = 25,
private ?string $nextCursor = null,
private array $sortBy = ['created_at' => 'desc']
) {
}
) {}

public function __toString(): string
{
Expand Down
3 changes: 1 addition & 2 deletions lib/API/Search/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public function __construct(
private int $totalCount,
private ?string $nextCursor = null,
private array $resources = []
) {
}
) {}

public function getTotalCount(): int
{
Expand Down
3 changes: 1 addition & 2 deletions lib/API/Upload/FileStruct.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ private function __construct(
private string $originalFilename,
private string $originalExtension,
private string $type = self::TYPE_LOCAL,
) {
}
) {}

public static function fromPath(string $path): self
{
Expand Down
3 changes: 1 addition & 2 deletions lib/API/Upload/ResourceStruct.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ public function __construct(
private array $tags = [],
private array $context = [],
private bool $hideFilename = false,
) {
}
) {}

public function getFileStruct(): FileStruct
{
Expand Down
3 changes: 1 addition & 2 deletions lib/API/Values/AuthToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ private function __construct(
private ?DateTimeImmutable $startsAt = null,
private ?DateTimeImmutable $expiresAt = null,
private ?string $ipAddress = null
) {
}
) {}

public static function fromDuration(int $duration): self
{
Expand Down
3 changes: 1 addition & 2 deletions lib/API/Values/CropSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ public function __construct(
private int $y = 0,
private int $width = 0,
private int $height = 0
) {
}
) {}

public static function fromArray(string $transformationName, array $coords): self
{
Expand Down
3 changes: 1 addition & 2 deletions lib/API/Values/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ final class Folder
public function __construct(
private string $name,
private ?self $parent = null
) {
}
) {}

public function __toString(): string
{
Expand Down
11 changes: 5 additions & 6 deletions lib/API/Values/RemoteResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RemoteResource
* @param string[] $tags
* @param array<string,mixed> $metadata
* @param array<string,mixed> $context
* @param \Doctrine\Common\Collections\Collection|\Netgen\RemoteMedia\API\Values\RemoteResourceLocation[] $locations
* @param Collection|\Netgen\RemoteMedia\API\Values\RemoteResourceLocation[] $locations
*/
public function __construct(
private string $remoteId,
Expand All @@ -61,9 +61,8 @@ public function __construct(
private array $tags = [],
private array $metadata = [],
private array $context = [],
private Collection|array $locations = [],
) {
}
private array|Collection $locations = [],
) {}

public function getId(): ?int
{
Expand Down Expand Up @@ -344,9 +343,9 @@ public function removeContextProperty(string $name): self
}

/**
* @return \Doctrine\Common\Collections\Collection|\Netgen\RemoteMedia\API\Values\RemoteResourceLocation[]
* @return Collection|\Netgen\RemoteMedia\API\Values\RemoteResourceLocation[]
*/
public function getLocations(): Collection|array
public function getLocations(): array|Collection
{
return $this->locations;
}
Expand Down
5 changes: 2 additions & 3 deletions lib/API/Values/RemoteResourceLocation.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public function __construct(
private array $cropSettings = [],
private ?string $watermarkText = null,
private ?int $id = null,
) {
}
) {}

public function getId(): ?int
{
Expand Down Expand Up @@ -60,7 +59,7 @@ public function setCropSettings(array $cropSettings): self
}

/**
* @throws \Netgen\RemoteMedia\Exception\CropSettingsNotFoundException
* @throws CropSettingsNotFoundException
*/
public function getCropSettingsForVariation(string $variationName): CropSettings
{
Expand Down
3 changes: 1 addition & 2 deletions lib/API/Values/RemoteResourceVariation.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ public function __construct(
private RemoteResource $resource,
private string $url,
private array $transformations = []
) {
}
) {}

public static function fromResource(RemoteResource $resource): self
{
Expand Down
3 changes: 1 addition & 2 deletions lib/API/Values/StatusData.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ final class StatusData
*/
public function __construct(
private array $properties = []
) {
}
) {}

public function has(string $key): bool
{
Expand Down
16 changes: 8 additions & 8 deletions lib/Core/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __construct(
/**
* @return \Netgen\RemoteMedia\API\Values\Folder[]
*
* @throws \Netgen\RemoteMedia\Exception\NotSupportedException
* @throws NotSupportedException
*/
public function listFolders(?Folder $parent = null): array
{
Expand All @@ -60,7 +60,7 @@ public function listFolders(?Folder $parent = null): array
}

/**
* @throws \Netgen\RemoteMedia\Exception\NotSupportedException
* @throws NotSupportedException
*/
public function createFolder(string $name, ?Folder $parent = null): Folder
{
Expand All @@ -72,7 +72,7 @@ public function createFolder(string $name, ?Folder $parent = null): Folder
}

/**
* @throws \Netgen\RemoteMedia\Exception\NotSupportedException
* @throws NotSupportedException
*/
public function countInFolder(Folder $folder): int
{
Expand All @@ -86,7 +86,7 @@ public function countInFolder(Folder $folder): int
/**
* @return string[]
*
* @throws \Netgen\RemoteMedia\Exception\NotSupportedException
* @throws NotSupportedException
*/
public function listTags(): array
{
Expand All @@ -98,7 +98,7 @@ public function listTags(): array
}

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceNotFoundException
* @throws RemoteResourceNotFoundException
*/
public function load(int $id): RemoteResource
{
Expand All @@ -112,7 +112,7 @@ public function load(int $id): RemoteResource
}

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceNotFoundException
* @throws RemoteResourceNotFoundException
*/
public function loadByRemoteId(string $remoteId): RemoteResource
{
Expand Down Expand Up @@ -165,7 +165,7 @@ public function remove(RemoteResource $resource): void
}

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceLocationNotFoundException
* @throws RemoteResourceLocationNotFoundException
*/
public function loadLocation(int $id): RemoteResourceLocation
{
Expand Down Expand Up @@ -388,7 +388,7 @@ abstract protected function generateDocumentTag(RemoteResource $resource, array
abstract protected function generateDownloadTag(RemoteResource $resource, array $transformations = [], array $htmlAttributes = []): string;

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceLocationNotFoundException
* @throws RemoteResourceLocationNotFoundException
*/
private function loadLocationBySource(string $source): RemoteResourceLocation
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Core/Provider/Cloudinary/CloudinaryProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function count(): int
}

/**
* @throws \Netgen\RemoteMedia\Exception\RemoteResourceNotFoundException
* @throws RemoteResourceNotFoundException
*/
public function loadFromRemote(string $remoteId): RemoteResource
{
Expand Down
Loading

0 comments on commit 1c44f2a

Please sign in to comment.