docs: clean unnecessary phpdocs (#880)

This commit is contained in:
Kyrch
2025-07-24 01:22:29 -03:00
committed by GitHub
parent 076eea744a
commit 5c5e96f2e6
2391 changed files with 205 additions and 22883 deletions
-20
View File
@@ -8,23 +8,12 @@ use App\Enums\Actions\ActionStatus;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
/**
* Class ActionResult.
*/
class ActionResult
{
/**
* Create a new action result instance.
*
* @param ActionStatus $status
* @param string|null $message
*/
public function __construct(protected readonly ActionStatus $status, protected readonly ?string $message = null) {}
/**
* Get the action result status.
*
* @return ActionStatus
*/
public function getStatus(): ActionStatus
{
@@ -33,8 +22,6 @@ class ActionResult
/**
* Get the action result message.
*
* @return string|null
*/
public function getMessage(): ?string
{
@@ -43,8 +30,6 @@ class ActionResult
/**
* Has the action failed?
*
* @return bool
*/
public function hasFailed(): bool
{
@@ -53,8 +38,6 @@ class ActionResult
/**
* Write results to log.
*
* @return void
*/
public function toLog(): void
{
@@ -65,9 +48,6 @@ class ActionResult
/**
* Write results to console output.
*
* @param Command $command
* @return void
*/
public function toConsole(Command $command): void
{
@@ -10,15 +10,10 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Http;
/**
* Class DiscordMessageAction.
*/
class DiscordMessageAction
{
/**
* Get the HTTP client for Discord API.
*
* @return PendingRequest
*/
public static function getHttp(): PendingRequest
{
@@ -30,7 +25,6 @@ class DiscordMessageAction
* Make the Discord message.
*
* @param array<string, mixed> $fields
* @return DiscordMessage
*/
public function makeMessage(array $fields): DiscordMessage
{
@@ -54,9 +48,6 @@ class DiscordMessageAction
/**
* Set the Discord message.
*
* @param string $url
* @return DiscordMessage
*/
public function get(string $url): DiscordMessage
{
@@ -72,9 +63,6 @@ class DiscordMessageAction
/**
* Edit the Discord message.
*
* @param DiscordMessage $message
* @return void
*/
public function edit(DiscordMessage $message): void
{
@@ -87,9 +75,6 @@ class DiscordMessageAction
/**
* Send the Discord message.
*
* @param DiscordMessage $message
* @return void
*/
public function send(DiscordMessage $message): void
{
+1 -7
View File
@@ -10,17 +10,12 @@ use Exception;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;
/**
* Class DiscordThreadAction.
*/
class DiscordThreadAction
{
/**
* Handle the action.
*
* @param Anime $anime
* @param array<string, mixed> $fields
* @return Exception|null
*/
public function handle(Anime $anime, array $fields): ?Exception
{
@@ -63,8 +58,7 @@ class DiscordThreadAction
/**
* Get the thread by ID.
*
* @param string $id
* @return array
* @return array<string, mixed>
*/
public function get(string $id): array
{
@@ -9,9 +9,6 @@ use App\Models\Wiki\Video;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
/**
* Class DiscordVideoNotificationAction.
*/
class DiscordVideoNotificationAction
{
/**
@@ -19,7 +16,6 @@ class DiscordVideoNotificationAction
*
* @param Collection<int, Video> $videos
* @param array<string, mixed> $fields
* @return void
*/
public function handle(Collection $videos, array $fields): void
{
-4
View File
@@ -14,16 +14,12 @@ use Illuminate\Validation\Rules\Password;
use Illuminate\Validation\ValidationException;
use Laravel\Fortify\Contracts\CreatesNewUsers;
/**
* Class CreateNewUser.
*/
class CreateNewUser implements CreatesNewUsers
{
/**
* Validate and create a newly registered user.
*
* @param array<string, string> $input
* @return User
*
* @throws ValidationException
*/
@@ -12,17 +12,12 @@ use Illuminate\Validation\Rules\Password;
use Illuminate\Validation\ValidationException;
use Laravel\Fortify\Contracts\ResetsUserPasswords;
/**
* Class ResetUserPassword.
*/
class ResetUserPassword implements ResetsUserPasswords
{
/**
* Validate and reset the user's forgotten password.
*
* @param User $user
* @param array<string, string> $input
* @return void
*
* @throws ValidationException
*/
@@ -13,17 +13,12 @@ use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator as IlluminateValidator;
use Laravel\Fortify\Contracts\UpdatesUserPasswords;
/**
* Class UpdateUserPassword.
*/
class UpdateUserPassword implements UpdatesUserPasswords
{
/**
* Validate and update the user's password.
*
* @param User $user
* @param array<string, string> $input
* @return void
*
* @throws ValidationException
*/
@@ -12,17 +12,12 @@ use Illuminate\Validation\Rule;
use Illuminate\Validation\ValidationException;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
/**
* Class UpdateUserProfileInformation.
*/
class UpdateUserProfileInformation implements UpdatesUserProfileInformation
{
/**
* Validate and update the given user's profile information.
*
* @param User $user
* @param array<string, string> $input
* @return void
*
* @throws ValidationException
*/
@@ -16,11 +16,6 @@ use Illuminate\Support\Facades\Config;
*/
class DumpDownloadAction extends DownloadAction
{
/**
* Create a new action instance.
*
* @param Dump $dump
*/
public function __construct(Dump $dump)
{
parent::__construct($dump);
@@ -28,8 +23,6 @@ class DumpDownloadAction extends DownloadAction
/**
* Get the path of the resource in storage.
*
* @return string
*/
protected function path(): string
{
@@ -38,8 +31,6 @@ class DumpDownloadAction extends DownloadAction
/**
* The name of the disk.
*
* @return string
*/
public function disk(): string
{
-1
View File
@@ -35,7 +35,6 @@ class DestroyAction
* Force delete model that doesn't apply soft deletes.
*
* @param TModel&Nameable $model
* @return string
*/
public function forceDelete(Model&Nameable $model): string
{
@@ -7,16 +7,10 @@ namespace App\Actions\Http\Api;
use App\Models\BaseModel;
use Illuminate\Support\Str;
/**
* Class ForceDeleteAction.
*/
class ForceDeleteAction
{
/**
* Force delete model.
*
* @param BaseModel $model
* @return string
*/
public function forceDelete(BaseModel $model): string
{
-15
View File
@@ -20,20 +20,12 @@ use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Config;
use RuntimeException;
/**
* Class IndexAction.
*/
class IndexAction
{
use ConstrainsEagerLoads;
/**
* Show paginated listing of models.
*
* @param Builder $builder
* @param Query $query
* @param Schema $schema
* @return Collection|Paginator
*/
public function index(Builder $builder, Query $query, Schema $schema): Collection|Paginator
{
@@ -68,11 +60,6 @@ class IndexAction
/**
* Search models.
*
* @param Query $query
* @param Schema $schema
* @param PaginationStrategy $paginationStrategy
* @return Collection|Paginator
*/
public function search(
Query $query,
@@ -93,8 +80,6 @@ class IndexAction
/**
* Get the search instance.
*
* @return Search|null
*/
protected function getSearch(): ?Search
{
@@ -13,18 +13,11 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
/**
* Class DestroyTrackAction.
*/
class DestroyTrackAction
{
/**
* Destroy playlist track.
*
* @param Playlist $playlist
* @param PlaylistTrack $track
* @return string
*
* @throws Exception
*/
public function destroy(Playlist $playlist, PlaylistTrack $track): string
@@ -17,18 +17,12 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class StoreTrackAction.
*/
class StoreTrackAction
{
/**
* Store playlist track.
*
* @param Playlist $playlist
* @param Builder $builder
* @param array $parameters
* @return PlaylistTrack
*
* @throws Exception
*/
@@ -16,18 +16,12 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class UpdateTrackAction.
*/
class UpdateTrackAction
{
/**
* Store playlist track.
*
* @param Playlist $playlist
* @param PlaylistTrack $track
* @param array $parameters
* @return PlaylistTrack
*
* @throws Exception
*/
-9
View File
@@ -7,16 +7,10 @@ namespace App\Actions\Http\Api;
use App\Contracts\Models\SoftDeletable;
use Illuminate\Database\Eloquent\Model;
/**
* Class RestoreAction.
*/
class RestoreAction
{
/**
* Restore model.
*
* @param Model&SoftDeletable $model
* @return Model&SoftDeletable
*/
public function restore(Model&SoftDeletable $model): Model&SoftDeletable
{
@@ -27,9 +21,6 @@ class RestoreAction
/**
* Perform model cleanup for presentation.
*
* @param Model&SoftDeletable $model
* @return Model&SoftDeletable
*/
public function cleanup(Model&SoftDeletable $model): Model&SoftDeletable
{
-8
View File
@@ -9,20 +9,12 @@ use App\Http\Api\Query\Query;
use App\Http\Api\Schema\Schema;
use Illuminate\Database\Eloquent\Model;
/**
* Class ShowAction.
*/
class ShowAction
{
use ConstrainsEagerLoads;
/**
* Show model.
*
* @param Model $model
* @param Query $query
* @param Schema $schema
* @return Model
*/
public function show(Model $model, Query $query, Schema $schema): Model
{
@@ -26,7 +26,6 @@ class StoreImageAction extends StoreAction
*
* @param Builder<Image> $builder
* @param array $parameters
* @return Image
*/
public function store(Builder $builder, array $parameters): Image
{
-6
View File
@@ -18,16 +18,12 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
abstract class DownloadAction implements InteractsWithDisk
{
/**
* Create a new action instance.
*
* @param TModel $model
*/
public function __construct(protected readonly BaseModel $model) {}
/**
* Download the resource.
*
* @return StreamedResponse
*/
public function download(): StreamedResponse
{
@@ -39,8 +35,6 @@ abstract class DownloadAction implements InteractsWithDisk
/**
* Get the path of the resource in storage.
*
* @return string
*/
abstract protected function path(): string;
}
-8
View File
@@ -8,16 +8,10 @@ use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Storage;
/**
* Class NginxStreamAction.
*/
abstract class NginxStreamAction extends StreamAction
{
/**
* Stream the resource.
*
* @param string $disposition
* @return Response
*/
public function stream(string $disposition = 'inline'): Response
{
@@ -48,8 +42,6 @@ abstract class NginxStreamAction extends StreamAction
/**
* Get the location of the nginx internal redirect.
*
* @return string
*/
abstract protected function nginxRedirect(): string;
}
@@ -7,16 +7,10 @@ namespace App\Actions\Http;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\StreamedResponse;
/**
* Class ResponseStreamAction.
*/
abstract class ResponseStreamAction extends StreamAction
{
/**
* Stream the resource.
*
* @param string $disposition
* @return StreamedResponse
*/
public function stream(string $disposition = 'inline'): StreamedResponse
{
-11
View File
@@ -8,23 +8,12 @@ use App\Contracts\Models\Streamable;
use App\Contracts\Storage\InteractsWithDisk;
use Symfony\Component\HttpFoundation\Response;
/**
* Class StreamAction.
*/
abstract class StreamAction implements InteractsWithDisk
{
/**
* Create a new action instance.
*
* @param Streamable $streamable
*/
public function __construct(protected readonly Streamable $streamable) {}
/**
* Stream the resource.
*
* @param string $disposition
* @return Response
*/
abstract public function stream(string $disposition = 'inline'): Response;
}
@@ -9,16 +9,8 @@ use App\Constants\Config\AudioConstants;
use App\Models\Wiki\Audio;
use Illuminate\Support\Facades\Config;
/**
* Class AudioNginxStreamAction.
*/
class AudioNginxStreamAction extends NginxStreamAction
{
/**
* Create a new action instance.
*
* @param Audio $audio
*/
public function __construct(Audio $audio)
{
parent::__construct($audio);
@@ -26,8 +18,6 @@ class AudioNginxStreamAction extends NginxStreamAction
/**
* The name of the disk.
*
* @return string
*/
public function disk(): string
{
@@ -36,8 +26,6 @@ class AudioNginxStreamAction extends NginxStreamAction
/**
* Get the location of the nginx internal redirect.
*
* @return string
*/
protected function nginxRedirect(): string
{
@@ -9,16 +9,8 @@ use App\Constants\Config\AudioConstants;
use App\Models\Wiki\Audio;
use Illuminate\Support\Facades\Config;
/**
* Class AudioResponseStreamAction.
*/
class AudioResponseStreamAction extends ResponseStreamAction
{
/**
* Create a new action instance.
*
* @param Audio $audio
*/
public function __construct(Audio $audio)
{
parent::__construct($audio);
@@ -26,8 +18,6 @@ class AudioResponseStreamAction extends ResponseStreamAction
/**
* The name of the disk.
*
* @return string
*/
public function disk(): string
{
@@ -16,11 +16,6 @@ use Illuminate\Support\Facades\Config;
*/
class ScriptDownloadAction extends DownloadAction
{
/**
* Create a new action instance.
*
* @param VideoScript $script
*/
public function __construct(VideoScript $script)
{
parent::__construct($script);
@@ -28,8 +23,6 @@ class ScriptDownloadAction extends DownloadAction
/**
* Get the path of the resource in storage.
*
* @return string
*/
protected function path(): string
{
@@ -38,8 +31,6 @@ class ScriptDownloadAction extends DownloadAction
/**
* The name of the disk.
*
* @return string
*/
public function disk(): string
{
@@ -9,16 +9,8 @@ use App\Constants\Config\VideoConstants;
use App\Models\Wiki\Video;
use Illuminate\Support\Facades\Config;
/**
* Class VideoNginxStreamAction.
*/
class VideoNginxStreamAction extends NginxStreamAction
{
/**
* Create a new action instance.
*
* @param Video $video
*/
public function __construct(Video $video)
{
parent::__construct($video);
@@ -26,8 +18,6 @@ class VideoNginxStreamAction extends NginxStreamAction
/**
* The name of the disk.
*
* @return string
*/
public function disk(): string
{
@@ -36,8 +26,6 @@ class VideoNginxStreamAction extends NginxStreamAction
/**
* Get the location of the nginx internal redirect.
*
* @return string
*/
protected function nginxRedirect(): string
{
@@ -9,16 +9,8 @@ use App\Constants\Config\VideoConstants;
use App\Models\Wiki\Video;
use Illuminate\Support\Facades\Config;
/**
* Class VideoResponseStreamAction.
*/
class VideoResponseStreamAction extends ResponseStreamAction
{
/**
* Create a new action instance.
*
* @param Video $video
*/
public function __construct(Video $video)
{
parent::__construct($video);
@@ -26,8 +18,6 @@ class VideoResponseStreamAction extends ResponseStreamAction
/**
* The name of the disk.
*
* @return string
*/
public function disk(): string
{
@@ -9,16 +9,11 @@ use App\Enums\Actions\ActionStatus;
use Exception;
use Illuminate\Support\Facades\DB;
/**
* Class SyncLikeAggregatesAction.
*/
class SyncLikeAggregatesAction
{
/**
* Handles the action.
*
* @return ActionResult
*
* @throws Exception
*/
public function handle(): ActionResult
@@ -9,16 +9,11 @@ use App\Enums\Actions\ActionStatus;
use Exception;
use Illuminate\Support\Facades\DB;
/**
* Class SyncViewAggregatesAction.
*/
class SyncViewAggregatesAction
{
/**
* Handles the action.
*
* @return ActionResult
*
* @throws Exception
*/
public function handle(): ActionResult
@@ -8,17 +8,10 @@ use App\Contracts\Models\HasHashids;
use App\Models\BaseModel;
use Vinkla\Hashids\Facades\Hashids;
/**
* Class AssignHashidsAction.
*/
class AssignHashidsAction
{
/**
* Assign Hashids to model.
*
* @param HasHashids&BaseModel $model
* @param string|null $connection
* @return void
*/
public function assign(HasHashids&BaseModel $model, ?string $connection = null): void
{
-8
View File
@@ -17,16 +17,12 @@ use Illuminate\Support\Str;
abstract class BackfillAction
{
/**
* Create a new action instance.
*
* @param TModel $model
*/
public function __construct(protected BaseModel $model) {}
/**
* Handle action.
*
* @return ActionResult
*/
abstract public function handle(): ActionResult;
@@ -39,15 +35,11 @@ abstract class BackfillAction
/**
* Get the relation to resources.
*
* @return Relation
*/
abstract protected function relation(): Relation;
/**
* Get the human-friendly label for the underlying model.
*
* @return string
*/
protected function label(): string
{
+1 -21
View File
@@ -19,9 +19,6 @@ use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use Illuminate\Support\Uri;
/**
* Class BackfillWikiAction.
*/
abstract class BackfillWikiAction
{
use CanCreateExternalResource;
@@ -31,32 +28,24 @@ abstract class BackfillWikiAction
final public const IMAGES = 'images';
/**
* Create a new action instance.
*
* @param BaseModel $model
* @param array $toBackfill
*/
public function __construct(protected BaseModel $model, protected array $toBackfill) {}
/**
* Handle the action.
*
* @return ActionResult
*/
abstract public function handle(): ActionResult;
/**
* Get the external API actions available for the backfill action.
*
* @return array<ExternalApiAction>
* @return ExternalApiAction[]
*/
abstract protected function getExternalApiActions(): array;
/**
* Create the resources given the response.
*
* @param ExternalApiAction $api
* @return void
*/
protected function forResources(ExternalApiAction $api): void
{
@@ -83,9 +72,6 @@ abstract class BackfillWikiAction
/**
* Create the images given the response.
*
* @param ExternalApiAction $api
* @return void
*/
protected function forImages(ExternalApiAction $api): void
{
@@ -112,10 +98,6 @@ abstract class BackfillWikiAction
/**
* Remove element already backfilled.
*
* @param mixed $enum
* @param string $scope
* @return void
*/
protected function backfilled(mixed $enum, string $scope): void
{
@@ -135,8 +117,6 @@ abstract class BackfillWikiAction
/**
* Get the human-friendly label for the underlying model.
*
* @return string
*/
protected function label(): string
{
@@ -24,22 +24,13 @@ abstract class BaseExternalEntryClaimedAction
/**
* The id of the external user.
*
* @var int|null
*/
protected ?int $userId = null;
/**
* Create a new action instance.
*
* @param ExternalToken $token
*/
public function __construct(protected ExternalToken $token) {}
/**
* Get the id of the external user.
*
* @return int|null
*/
public function getUserId(): ?int
{
@@ -48,8 +39,6 @@ abstract class BaseExternalEntryClaimedAction
/**
* Get the token to the request.
*
* @return string
*/
protected function getToken(): string
{
@@ -58,8 +47,6 @@ abstract class BaseExternalEntryClaimedAction
/**
* Get the username.
*
* @return string|null
*/
abstract public function getUsername(): ?string;
@@ -73,8 +60,6 @@ abstract class BaseExternalEntryClaimedAction
/**
* Make the request to the external api.
*
* @return void
*
* @throws RequestException
*/
abstract protected function makeRequest(): void;
@@ -23,16 +23,12 @@ abstract class BaseExternalEntryUnclaimedAction
protected ?array $data = null;
/**
* Create a new action instance.
*
* @param ExternalProfile|array $profile
*/
public function __construct(protected ExternalProfile|array $profile) {}
/**
* Get the username of the profile.
*
* @return string
*/
public function getUsername(): string
{
@@ -45,8 +41,6 @@ abstract class BaseExternalEntryUnclaimedAction
/**
* Get the id of the external user.
*
* @return int|null
*/
abstract public function getId(): ?int;
@@ -60,8 +54,6 @@ abstract class BaseExternalEntryUnclaimedAction
/**
* Make the request to the external api.
*
* @return void
*
* @throws RequestException
*/
abstract protected function makeRequest(): void;
@@ -13,9 +13,6 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
/**
* Class AnilistExternalEntryClaimedAction.
*/
class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
{
/**
@@ -52,8 +49,6 @@ class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
/**
* Get the username.
*
* @return string|null
*/
public function getUsername(): ?string
{
@@ -66,8 +61,6 @@ class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
/**
* Get the id of the external user.
*
* @return int|null
*/
public function getUserId(): ?int
{
@@ -87,8 +80,6 @@ class AnilistExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
/**
* Make the request to the external api.
*
* @return void
*
* @throws RequestException
*/
protected function makeRequest(): void
@@ -15,9 +15,6 @@ use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\RateLimiter;
/**
* Class MalExternalEntryClaimedAction.
*/
class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
{
/**
@@ -63,8 +60,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
/**
* Get the username.
*
* @return string|null
*/
public function getUsername(): ?string
{
@@ -77,8 +72,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
/**
* Get the id of the external user.
*
* @return int|null
*/
public function getUserId(): ?int
{
@@ -92,8 +85,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
/**
* Make the request to the user endpoint of the external api.
*
* @return void
*
* @throws RequestException
*/
protected function makeUserRequest(): void
@@ -113,8 +104,6 @@ class MalExternalEntryClaimedAction extends BaseExternalEntryClaimedAction
/**
* Make the request to the external api.
*
* @return void
*
* @throws RequestException
*/
protected function makeRequest(): void
@@ -13,9 +13,6 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
/**
* Class AnilistExternalEntryUnclaimedAction.
*/
class AnilistExternalEntryUnclaimedAction extends BaseExternalEntryUnclaimedAction
{
/**
@@ -51,8 +48,6 @@ class AnilistExternalEntryUnclaimedAction extends BaseExternalEntryUnclaimedActi
/**
* Get the id of the external user.
*
* @return int|null
*/
public function getId(): ?int
{
@@ -66,8 +61,6 @@ class AnilistExternalEntryUnclaimedAction extends BaseExternalEntryUnclaimedActi
/**
* Make the request to the external api.
*
* @return void
*
* @throws RequestException
*/
protected function makeRequest(): void
@@ -18,9 +18,6 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use RuntimeException;
/**
* Class StoreExternalProfileClaimedAction.
*/
class StoreExternalProfileClaimedAction
{
protected Collection $resources;
@@ -28,9 +25,7 @@ class StoreExternalProfileClaimedAction
/**
* Get the first record or store external profile given determined external token.
*
* @param ExternalToken $token
* @param array $parameters
* @return ExternalProfile
*
* @throws Exception
*/
@@ -56,11 +51,7 @@ class StoreExternalProfileClaimedAction
/**
* Get the first record or create the profile for a userId and site.
*
* @param int $userId
* @param ExternalProfileSite $site
* @param BaseExternalEntryClaimedAction $action
* @param array $parameters
* @return ExternalProfile
*/
protected function firstForUserIdOrCreate(int $userId, ExternalProfileSite $site, BaseExternalEntryClaimedAction $action, array $parameters): ExternalProfile
{
@@ -108,10 +99,6 @@ class StoreExternalProfileClaimedAction
/**
* Get the mapping for the entries token class.
*
* @param ExternalProfileSite $site
* @param ExternalToken $token
* @return BaseExternalEntryClaimedAction
*
* @throws RuntimeException
*/
public static function getActionClass(ExternalProfileSite $site, ExternalToken $token): BaseExternalEntryClaimedAction
@@ -17,17 +17,12 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use RuntimeException;
/**
* Class StoreExternalProfileUnclaimedAction.
*/
class StoreExternalProfileUnclaimedAction
{
/**
* Get the first record or store an external profile and its entries given determined username.
*
* @param Builder $builder
* @param array $profileParameters
* @return ExternalProfile
*
* @throws Exception
*/
@@ -84,9 +79,7 @@ class StoreExternalProfileUnclaimedAction
/**
* Get the mapping for the entries class.
*
* @param ExternalProfileSite $site
* @param ExternalProfile|array $profile
* @return BaseExternalEntryUnclaimedAction
*
* @throws RuntimeException
*/
@@ -19,9 +19,6 @@ use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class SyncExternalProfileAction.
*/
class SyncExternalProfileAction
{
protected Collection $resources;
@@ -29,9 +26,6 @@ class SyncExternalProfileAction
/**
* Sync the profile.
*
* @param ExternalProfile $profile
* @return ExternalProfile
*
* @throws Exception
*/
public function handle(ExternalProfile $profile): ExternalProfile
@@ -95,9 +89,6 @@ class SyncExternalProfileAction
/**
* Get the mapping for the entries token class.
*
* @param ExternalProfile $profile
* @return BaseExternalEntryClaimedAction
*/
protected function getClaimedActionClass(ExternalProfile $profile): BaseExternalEntryClaimedAction
{
@@ -106,9 +97,6 @@ class SyncExternalProfileAction
/**
* Get the mapping for the entries class.
*
* @param ExternalProfile $profile
* @return BaseExternalEntryUnclaimedAction
*/
protected function getUnclaimedActionClass(ExternalProfile $profile): BaseExternalEntryUnclaimedAction
{
@@ -117,9 +105,6 @@ class SyncExternalProfileAction
/**
* Cache the resources for performance proposals.
*
* @param ExternalProfileSite $profileSite
* @return void
*/
protected function cacheResources(ExternalProfileSite $profileSite): void
{
@@ -137,7 +122,6 @@ class SyncExternalProfileAction
/**
* Get the animes by the external id.
*
* @param int $externalId
* @return Collection<int, int>
*/
protected function getAnimesByExternalId(int $externalId): Collection
@@ -7,16 +7,12 @@ namespace App\Actions\Models\List\External\Token;
use App\Models\List\External\ExternalToken;
use Exception;
/**
* Class BaseExternalTokenAction.
*/
abstract class BaseExternalTokenAction
{
/**
* Use the authorization code to get the tokens and store them.
*
* @param array $parameters
* @return ExternalToken
*
* @throws Exception
*/
@@ -14,16 +14,12 @@ use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
/**
* Class AnilistExternalTokenAction.
*/
class AnilistExternalTokenAction extends BaseExternalTokenAction
{
/**
* Use the authorization code to get the tokens and store them.
*
* @param array $parameters
* @return ExternalToken
*
* @throws Exception
*/
@@ -24,7 +24,6 @@ class MalExternalTokenAction extends BaseExternalTokenAction
* Use the authorization code to get the tokens and store them.
*
* @param array $parameters
* @return ExternalToken
*
* @throws Exception
*/
@@ -18,16 +18,12 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use RuntimeException;
/**
* Class ExternalTokenCallbackAction.
*/
class ExternalTokenCallbackAction
{
/**
* We should store the token and the profile.
*
* @param array $parameters
* @return ExternalProfile
*
* @throws Exception
*/
@@ -69,9 +65,6 @@ class ExternalTokenCallbackAction
/**
* Get the mapping for the token class.
*
* @param ExternalProfileSite $site
* @return BaseExternalTokenAction
*
* @throws RuntimeException
*/
protected function getActionClass(ExternalProfileSite $site): BaseExternalTokenAction
@@ -11,17 +11,10 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class FixPlaylistAction.
*/
class FixPlaylistAction
{
/**
* Handle the action.
*
* @param Playlist $playlist,
* @param mixed $context
* @return int
*/
public function handle(Playlist $playlist, mixed $context = null): int
{
@@ -114,11 +107,6 @@ class FixPlaylistAction
/**
* Send the message given the context.
*
* @param string $message
* @param mixed $context
* @param string $type
* @return void
*/
protected function sendMessage(string $message, mixed $context, string $type): void
{
@@ -10,18 +10,11 @@ use Exception;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class InsertTrackAction.
*/
class InsertTrackAction
{
/**
* Append track to playlist.
*
* @param Playlist $playlist
* @param PlaylistTrack $track
* @return void
*
* @throws Exception
*/
public function insert(Playlist $playlist, PlaylistTrack $track): void
@@ -10,19 +10,11 @@ use Exception;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class InsertTrackAfterAction.
*/
class InsertTrackAfterAction
{
/**
* Insert track after previous track.
*
* @param Playlist $playlist
* @param PlaylistTrack $track
* @param PlaylistTrack $previous
* @return void
*
* @throws Exception
*/
public function insertAfter(Playlist $playlist, PlaylistTrack $track, PlaylistTrack $previous): void
@@ -10,19 +10,11 @@ use Exception;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class InsertTrackBeforeAction.
*/
class InsertTrackBeforeAction
{
/**
* Insert track before next track.
*
* @param Playlist $playlist
* @param PlaylistTrack $track
* @param PlaylistTrack $next
* @return void
*
* @throws Exception
*/
public function insertBefore(Playlist $playlist, PlaylistTrack $track, PlaylistTrack $next): void
@@ -10,18 +10,11 @@ use Exception;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class RemoveTrackAction.
*/
class RemoveTrackAction
{
/**
* Remove track from playlist.
*
* @param Playlist $playlist
* @param PlaylistTrack $track
* @return void
*
* @throws Exception
*/
public function remove(Playlist $playlist, PlaylistTrack $track): void
@@ -11,16 +11,10 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Support\Facades\Date;
/**
* Class ManageStepAction.
*/
class ManageStepAction
{
/**
* Execute the action and approve the step.
*
* @param ReportStep $step
* @return void
*/
public static function approveStep(ReportStep $step): void
{
@@ -36,9 +30,6 @@ class ManageStepAction
/**
* Create the model according the step.
*
* @param ReportStep $step
* @return void
*/
protected static function approveCreate(ReportStep $step): void
{
@@ -52,9 +43,6 @@ class ManageStepAction
/**
* Delete the model according the step.
*
* @param ReportStep $step
* @return void
*/
protected static function approveDelete(ReportStep $step): void
{
@@ -65,9 +53,6 @@ class ManageStepAction
/**
* Update the model according the step.
*
* @param ReportStep $step
* @return void
*/
protected static function approveUpdate(ReportStep $step): void
{
@@ -78,9 +63,6 @@ class ManageStepAction
/**
* Attach a model to another according the step.
*
* @param ReportStep $step
* @return void
*/
protected static function approveAttach(ReportStep $step): void
{
@@ -94,9 +76,6 @@ class ManageStepAction
/**
* Detach a model from another according the step.
*
* @param ReportStep $step
* @return void
*/
protected static function approveDetach(ReportStep $step): void
{
@@ -110,9 +89,6 @@ class ManageStepAction
/**
* Approve the step.
*
* @param ReportStep $step
* @return void
*/
protected static function markAsApproved(ReportStep $step): void
{
@@ -121,9 +97,6 @@ class ManageStepAction
/**
* Reject the step.
*
* @param ReportStep $step
* @return void
*/
protected static function markAsRejected(ReportStep $step): void
{
@@ -132,9 +105,6 @@ class ManageStepAction
/**
* Approve partially the step.
*
* @param ReportStep $step
* @return void
*/
protected static function markAsPartiallyApproved(ReportStep $step): void
{
@@ -143,10 +113,6 @@ class ManageStepAction
/**
* Update the status of the step.
*
* @param ReportStep $step
* @param ApprovableStatus $status
* @return void
*/
protected static function updateStatus(ReportStep $step, ApprovableStatus $status): void
{
@@ -13,17 +13,12 @@ use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
/**
* Class ReportAction.
*/
class ReportAction
{
/**
* Create a report with the given steps.
*
* @param ReportStep|ReportStep[] $steps
* @param string|null $notes
* @return Report
*/
public static function makeReport(ReportStep|array $steps, ?string $notes = null): Report
{
@@ -43,7 +38,6 @@ class ReportAction
*
* @param class-string<Model> $model
* @param array $fields
* @return ReportStep
*/
public static function makeForCreate(string $model, array $fields): ReportStep
{
@@ -53,9 +47,7 @@ class ReportAction
/**
* Create a report step to edit a model.
*
* @param Model $model
* @param array $fields
* @return ReportStep
*/
public static function makeForUpdate(Model $model, array $fields): ReportStep
{
@@ -64,9 +56,6 @@ class ReportAction
/**
* Create a report step to delete a model.
*
* @param Model $model
* @return ReportStep
*/
public static function makeForDelete(Model $model): ReportStep
{
@@ -76,11 +65,8 @@ class ReportAction
/**
* Create a report step to attach a model to another in a many-to-many relationship.
*
* @param Model $foreign
* @param Model $related
* @param class-string<Pivot> $pivot
* @param array $fields
* @return ReportStep
*/
public static function makeForAttach(Model $foreign, Model $related, string $pivot, array $fields): ReportStep
{
@@ -90,11 +76,7 @@ class ReportAction
/**
* Create a report step to detach a model from another in a many-to-many relationship.
*
* @param Model $foreign
* @param Model $related
* @param Pivot $pivot
* @param array $fields
* @return ReportStep
*/
public static function makeForDetach(Model $foreign, Model $related, Pivot $pivot, array $fields): ReportStep
{
@@ -104,12 +86,8 @@ class ReportAction
/**
* Create a report step for given action.
*
* @param ReportActionType $action
* @param class-string<Model>|Model $model
* @param array|null $fields
* @param Model|null $related
* @param Pivot|null $pivot
* @return ReportStep
*/
protected static function makeFor(ReportActionType $action, Model|string $model, ?array $fields = null, ?Model $related = null, Pivot|string|null $pivot = null): ReportStep
{
@@ -17,15 +17,10 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Http;
/**
* Class AnilistAnimeExternalApiAction.
*/
class AnilistAnimeExternalApiAction extends ExternalApiAction implements BackfillImages, BackfillResources, BackfillSynonyms
{
/**
* Get the site to backfill.
*
* @return ResourceSite
*/
public function getSite(): ResourceSite
{
@@ -36,7 +31,6 @@ class AnilistAnimeExternalApiAction extends ExternalApiAction implements Backfil
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource, Anime> $resources
* @return static
*/
public function handle(BelongsToMany $resources): static
{
@@ -13,15 +13,10 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Http;
/**
* Class JikanAnimeExternalApiAction.
*/
class JikanAnimeExternalApiAction extends ExternalApiAction implements BackfillResources
{
/**
* Get the site to backfill.
*
* @return ResourceSite
*/
public function getSite(): ResourceSite
{
@@ -32,7 +27,6 @@ class JikanAnimeExternalApiAction extends ExternalApiAction implements BackfillR
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource, Anime> $resources
* @return static
*/
public function handle(BelongsToMany $resources): static
{
@@ -12,15 +12,10 @@ use App\Models\Wiki\ExternalResource;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Facades\Http;
/**
* Class LivechartAnimeExternalApiAction.
*/
class LivechartAnimeExternalApiAction extends ExternalApiAction implements BackfillResources
{
/**
* Get the site to backfill.
*
* @return ResourceSite
*/
public function getSite(): ResourceSite
{
@@ -31,7 +26,6 @@ class LivechartAnimeExternalApiAction extends ExternalApiAction implements Backf
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource, Anime> $resources
* @return static
*/
public function handle(BelongsToMany $resources): static
{
@@ -14,15 +14,10 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Http;
/**
* Class MalAnimeExternalApiAction.
*/
class MalAnimeExternalApiAction extends ExternalApiAction implements BackfillStudios
{
/**
* Get the site to backfill.
*
* @return ResourceSite
*/
public function getSite(): ResourceSite
{
@@ -33,7 +28,6 @@ class MalAnimeExternalApiAction extends ExternalApiAction implements BackfillStu
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource, Anime> $resources
* @return static
*/
public function handle(BelongsToMany $resources): static
{
@@ -10,9 +10,6 @@ use App\Enums\Models\Wiki\ImageFacet;
use App\Models\BaseModel;
use Illuminate\Support\Arr;
/**
* Class AttachImageAction.
*/
class AttachImageAction
{
use CanCreateImage;
@@ -20,10 +17,8 @@ class AttachImageAction
/**
* Perform the action on the given models.
*
* @param BaseModel&HasImages $model
* @param array $fields
* @param ImageFacet[] $facets
* @return void
*/
public function handle(BaseModel&HasImages $model, array $fields, array $facets): void
{
@@ -10,9 +10,6 @@ use App\Enums\Models\Wiki\ResourceSite;
use App\Models\BaseModel;
use Illuminate\Support\Arr;
/**
* Class AttachResourceAction.
*/
class AttachResourceAction
{
use CanCreateExternalResource;
@@ -20,10 +17,8 @@ class AttachResourceAction
/**
* Handle the action.
*
* @param BaseModel&HasResources $model
* @param array $fields
* @param ResourceSite[] $sites
* @return void
*/
public function handle(BaseModel&HasResources $model, array $fields, array $sites): void
{
@@ -24,9 +24,6 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class BackfillAnimeAction.
*/
class BackfillAnimeAction extends BackfillWikiAction
{
use CanCreateAnimeSynonym;
@@ -36,9 +33,6 @@ class BackfillAnimeAction extends BackfillWikiAction
final public const SYNONYMS = 'synonyms';
/**
* Create a new action instance.
*
* @param Anime $anime
* @param array $toBackfill
*/
public function __construct(protected Anime $anime, protected array $toBackfill)
@@ -48,8 +42,6 @@ class BackfillAnimeAction extends BackfillWikiAction
/**
* Handle the action.
*
* @return ActionResult
*/
public function handle(): ActionResult
{
@@ -71,19 +63,19 @@ class BackfillAnimeAction extends BackfillWikiAction
$response = $api->handle($this->getModel()->resources());
if ($api instanceof BackfillResources) {
if ($response instanceof BackfillResources) {
$this->forResources($response);
}
if ($api instanceof BackfillImages) {
if ($response instanceof BackfillImages) {
$this->forImages($response);
}
if ($api instanceof BackfillStudios) {
if ($response instanceof BackfillStudios) {
$this->forStudios($response);
}
if ($api instanceof BackfillSynonyms) {
if ($response instanceof BackfillSynonyms) {
$this->forSynonyms($response);
}
@@ -103,7 +95,7 @@ class BackfillAnimeAction extends BackfillWikiAction
/**
* Get the external API actions available for the backfill action.
*
* @return array
* @return ExternalApiAction[]
*/
protected function getExternalApiActions(): array
{
@@ -117,9 +109,6 @@ class BackfillAnimeAction extends BackfillWikiAction
/**
* Create the studios given the response.
*
* @param ExternalApiAction&BackfillStudios $response
* @return void
*/
protected function forStudios(ExternalApiAction&BackfillStudios $response): void
{
@@ -153,9 +142,6 @@ class BackfillAnimeAction extends BackfillWikiAction
/**
* Create the synonyms given the response.
*
* @param ExternalApiAction&BackfillSynonyms $api
* @return void
*/
protected function forSynonyms(ExternalApiAction&BackfillSynonyms $api): void
{
@@ -181,8 +167,6 @@ class BackfillAnimeAction extends BackfillWikiAction
/**
* Get the model for the action.
*
* @return Anime
*/
protected function getModel(): Anime
{
@@ -26,12 +26,6 @@ class BackfillSongAction extends BackfillAction
{
use CanCreateExternalResource;
/**
* Create a new action instance.
*
* @param Song $song
* @param string $lnkto
*/
public function __construct(
Song $song,
protected readonly string $lnkto,
@@ -42,8 +36,6 @@ class BackfillSongAction extends BackfillAction
/**
* Handle action.
*
* @return ActionResult
*
* @throws Exception
*/
public function handle(): ActionResult
@@ -85,9 +77,6 @@ class BackfillSongAction extends BackfillAction
/**
* Get the resource site according the external label.
*
* @param string $label
* @return ResourceSite|null
*/
protected function getMappingFromExternalSite(string $label): ?ResourceSite
{
@@ -102,8 +91,6 @@ class BackfillSongAction extends BackfillAction
/**
* Get the model the action is handling.
*
* @return Song
*/
protected function getModel(): Song
{
@@ -14,15 +14,9 @@ use Exception;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class BackfillStudioAction.
*/
class BackfillStudioAction extends BackfillWikiAction
{
/**
* Create a new action instance.
*
* @param Studio $studio
* @param array $toBackfill
*/
public function __construct(protected Studio $studio, protected array $toBackfill)
@@ -32,8 +26,6 @@ class BackfillStudioAction extends BackfillWikiAction
/**
* Handle the action.
*
* @return ActionResult
*/
public function handle(): ActionResult
{
@@ -71,7 +63,7 @@ class BackfillStudioAction extends BackfillWikiAction
/**
* Get the external API actions available for the backfill action.
*
* @return array
* @return ExternalApiAction[]
*/
protected function getExternalApiActions(): array
{
@@ -82,8 +74,6 @@ class BackfillStudioAction extends BackfillWikiAction
/**
* Get the model for the action.
*
* @return Studio
*/
protected function getModel(): Studio
{
@@ -11,9 +11,6 @@ use App\Enums\Models\Wiki\ResourceSite;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Support\Arr;
/**
* Class ExternalApiAction.
*/
abstract class ExternalApiAction
{
/**
@@ -25,8 +22,6 @@ abstract class ExternalApiAction
/**
* Get the site to backfill.
*
* @return ResourceSite
*/
abstract public function getSite(): ResourceSite;
@@ -34,7 +29,6 @@ abstract class ExternalApiAction
* Set the response after the request.
*
* @param BelongsToMany $resources
* @return static
*/
abstract public function handle(BelongsToMany $resources): static;
@@ -14,9 +14,6 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
/**
* Class ManageSongPerformances.
*/
class ManageSongPerformances
{
protected int $song;
@@ -25,9 +22,6 @@ class ManageSongPerformances
/**
* Add the song of the performances.
*
* @param Song|int $song
* @return static
*/
public function forSong(Song|int $song): static
{
@@ -38,11 +32,6 @@ class ManageSongPerformances
/**
* Add a single artist to the song performance.
*
* @param int $artist
* @param string|null $alias
* @param string|null $as
* @return static
*/
public function addSingleArtist(int $artist, ?string $alias = null, ?string $as = null): static
{
@@ -58,11 +47,6 @@ class ManageSongPerformances
/**
* Add a group data to the performance.
*
* @param int $group
* @param string|null $alias
* @param string|null $as
* @return static
*/
public function addGroupData(int $group, ?string $alias = null, ?string $as = null): static
{
@@ -76,12 +60,6 @@ class ManageSongPerformances
/**
* Add a membership to the song.
*
* @param int $group
* @param int $member
* @param string|null $alias
* @param string|null $as
* @return static
*/
public function addMembership(int $group, int $member, ?string $alias = null, ?string $as = null): static
{
@@ -102,8 +80,6 @@ class ManageSongPerformances
/**
* Commit the performances to the song.
*
* @return static
*/
public function commit(): static
{
@@ -12,15 +12,10 @@ use App\Models\Wiki\ExternalResource;
use App\Models\Wiki\Studio;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
/**
* Class MalStudioExternalApiAction.
*/
class MalStudioExternalApiAction extends ExternalApiAction implements BackfillImages
{
/**
* Get the site to backfill.
*
* @return ResourceSite
*/
public function getSite(): ResourceSite
{
@@ -31,7 +26,6 @@ class MalStudioExternalApiAction extends ExternalApiAction implements BackfillIm
* Set the response after the request.
*
* @param BelongsToMany<ExternalResource, Studio> $resources
* @return static
*/
public function handle(BelongsToMany $resources): static
{
@@ -39,13 +39,6 @@ use Illuminate\Support\Str;
*/
class BackfillAudioAction extends BackfillAction
{
/**
* Create a new action instance.
*
* @param Video $video
* @param DeriveSourceVideo $deriveSourceVideo
* @param OverwriteAudio $overwriteAudio
*/
public function __construct(
Video $video,
protected readonly DeriveSourceVideo $deriveSourceVideo = DeriveSourceVideo::YES,
@@ -58,8 +51,6 @@ class BackfillAudioAction extends BackfillAction
/**
* Handle action.
*
* @return ActionResult
*
* @throws Exception
*/
public function handle(): ActionResult
@@ -103,8 +94,6 @@ class BackfillAudioAction extends BackfillAction
/**
* Get the model the action is handling.
*
* @return Video
*/
protected function getModel(): Video
{
@@ -113,8 +102,6 @@ class BackfillAudioAction extends BackfillAction
/**
* Get the relation to audio.
*
* @return BelongsTo
*/
protected function relation(): BelongsTo
{
@@ -123,8 +110,6 @@ class BackfillAudioAction extends BackfillAction
/**
* Determine if the source video should be derived.
*
* @return bool
*/
protected function deriveSourceVideo(): bool
{
@@ -133,8 +118,6 @@ class BackfillAudioAction extends BackfillAction
/**
* Determine if audio should be overwritten.
*
* @return bool
*/
protected function overwriteAudio(): bool
{
@@ -143,8 +126,6 @@ class BackfillAudioAction extends BackfillAction
/**
* Determine if the new audio should replace a related one.
*
* @return bool
*/
protected function replaceRelatedAudio(): bool
{
@@ -154,8 +135,6 @@ class BackfillAudioAction extends BackfillAction
/**
* Get or Create Audio.
*
* @return Audio|null
*
* @throws Exception
*/
protected function getAudio(): ?Audio
@@ -213,9 +192,6 @@ class BackfillAudioAction extends BackfillAction
/**
* Get the source video for the given video.
*
* @param string $operation
* @return Video|null
*/
protected function getSourceVideo(string $operation = '>'): ?Video
{
@@ -269,9 +245,6 @@ class BackfillAudioAction extends BackfillAction
/**
* Extract audio stream from video and store in filesystem.
*
* @param Video $video
* @return Audio|null
*/
protected function extractAudio(Video $video): ?Audio
{
@@ -319,9 +292,6 @@ class BackfillAudioAction extends BackfillAction
/**
* Attach Audio to model.
*
* @param Audio $audio
* @return void
*/
protected function attachAudio(Audio $audio): void
{
@@ -33,8 +33,6 @@ class ReconcileDumpRepositoriesAction extends ReconcileRepositoriesAction
/**
* Callback for create and delete set operation item comparison.
*
* @return Closure
*/
protected function diffCallbackForCreateDelete(): Closure
{
@@ -53,8 +51,6 @@ class ReconcileDumpRepositoriesAction extends ReconcileRepositoriesAction
/**
* Callback for update set operation item comparison.
*
* @return Closure
*/
protected function diffCallbackForUpdate(): Closure
{
@@ -65,8 +61,6 @@ class ReconcileDumpRepositoriesAction extends ReconcileRepositoriesAction
* Get source model that has been updated for destination model.
*
* @param Collection $sourceModels
* @param Model $destinationModel
* @return Model|null
*/
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
{
@@ -79,7 +73,6 @@ class ReconcileDumpRepositoriesAction extends ReconcileRepositoriesAction
* @param Collection $created
* @param Collection $deleted
* @param Collection $updated
* @return ReconcileResults
*/
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
{
@@ -24,7 +24,6 @@ abstract class ReconcileRepositoriesAction
*
* @param RepositoryInterface<TModel> $source
* @param RepositoryInterface<TModel> $destination
* @return ReconcileResults
*
* @throws Exception
*/
@@ -66,8 +65,6 @@ abstract class ReconcileRepositoriesAction
/**
* Callback for create and delete set operation item comparison.
*
* @return Closure
*/
abstract protected function diffCallbackForCreateDelete(): Closure;
@@ -116,8 +113,6 @@ abstract class ReconcileRepositoriesAction
/**
* Callback for update set operation item comparison.
*
* @return Closure
*/
abstract protected function diffCallbackForUpdate(): Closure;
@@ -125,8 +120,6 @@ abstract class ReconcileRepositoriesAction
* Get source model that has been updated for destination model.
*
* @param Collection $sourceModels
* @param Model $destinationModel
* @return Model|null
*/
abstract protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model;
@@ -159,7 +152,6 @@ abstract class ReconcileRepositoriesAction
* @param Collection $created
* @param Collection $deleted
* @param Collection $updated
* @return ReconcileResults
*/
abstract protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults;
}
@@ -21,8 +21,6 @@ use Illuminate\Support\Str;
abstract class ReconcileResults extends ActionResult
{
/**
* Create a new results instance.
*
* @param Collection $created
* @param Collection $deleted
* @param Collection $updated
@@ -67,8 +65,6 @@ abstract class ReconcileResults extends ActionResult
/**
* Determines if any successful changes were made during reconciliation.
*
* @return bool
*/
public function hasChanges(): bool
{
@@ -78,8 +74,6 @@ abstract class ReconcileResults extends ActionResult
/**
* Write reconcile results to log.
*
* @return void
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function toLog(): void
@@ -94,9 +88,6 @@ abstract class ReconcileResults extends ActionResult
/**
* Write reconcile results to console output.
*
* @param Command $command
* @return void
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function toConsole(Command $command): void
@@ -111,8 +102,6 @@ abstract class ReconcileResults extends ActionResult
/**
* Get the action result message.
*
* @return string|null
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function getMessage(): ?string
@@ -135,7 +124,6 @@ abstract class ReconcileResults extends ActionResult
* Get the user-friendly label for the model class name.
*
* @param int|array|Countable $models
* @return string
*/
protected function label(int|array|Countable $models = 1): string
{
@@ -33,8 +33,6 @@ class ReconcileAudioRepositoriesAction extends ReconcileRepositoriesAction
/**
* Callback for create and delete set operation item comparison.
*
* @return Closure
*/
protected function diffCallbackForCreateDelete(): Closure
{
@@ -60,8 +58,6 @@ class ReconcileAudioRepositoriesAction extends ReconcileRepositoriesAction
/**
* Callback for update set operation item comparison.
*
* @return Closure
*/
protected function diffCallbackForUpdate(): Closure
{
@@ -72,8 +68,6 @@ class ReconcileAudioRepositoriesAction extends ReconcileRepositoriesAction
* Get source model that has been updated for destination model.
*
* @param Collection $sourceModels
* @param Model $destinationModel
* @return Model|null
*/
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
{
@@ -89,7 +83,6 @@ class ReconcileAudioRepositoriesAction extends ReconcileRepositoriesAction
* @param Collection $created
* @param Collection $deleted
* @param Collection $updated
* @return ReconcileResults
*/
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
{
@@ -33,8 +33,6 @@ class ReconcileVideoRepositoriesAction extends ReconcileRepositoriesAction
/**
* Callback for create and delete set operation item comparison.
*
* @return Closure
*/
protected function diffCallbackForCreateDelete(): Closure
{
@@ -60,8 +58,6 @@ class ReconcileVideoRepositoriesAction extends ReconcileRepositoriesAction
/**
* Callback for update set operation item comparison.
*
* @return Closure
*/
protected function diffCallbackForUpdate(): Closure
{
@@ -72,8 +68,6 @@ class ReconcileVideoRepositoriesAction extends ReconcileRepositoriesAction
* Get source model that has been updated for destination model.
*
* @param Collection $sourceModels
* @param Model $destinationModel
* @return Model|null
*/
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
{
@@ -89,7 +83,6 @@ class ReconcileVideoRepositoriesAction extends ReconcileRepositoriesAction
* @param Collection $created
* @param Collection $deleted
* @param Collection $updated
* @return ReconcileResults
*/
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
{
@@ -33,8 +33,6 @@ class ReconcileScriptRepositoriesAction extends ReconcileRepositoriesAction
/**
* Callback for create and delete set operation item comparison.
*
* @return Closure
*/
protected function diffCallbackForCreateDelete(): Closure
{
@@ -53,8 +51,6 @@ class ReconcileScriptRepositoriesAction extends ReconcileRepositoriesAction
/**
* Callback for update set operation item comparison.
*
* @return Closure
*/
protected function diffCallbackForUpdate(): Closure
{
@@ -65,8 +61,6 @@ class ReconcileScriptRepositoriesAction extends ReconcileRepositoriesAction
* Get source model that has been updated for destination model.
*
* @param Collection $sourceModels
* @param Model $destinationModel
* @return Model|null
*/
protected function resolveUpdatedModel(Collection $sourceModels, Model $destinationModel): ?Model
{
@@ -79,7 +73,6 @@ class ReconcileScriptRepositoriesAction extends ReconcileRepositoriesAction
* @param Collection $created
* @param Collection $deleted
* @param Collection $updated
* @return ReconcileResults
*/
protected function getResults(Collection $created, Collection $deleted, Collection $updated): ReconcileResults
{
@@ -27,14 +27,9 @@ use Spatie\DbDumper\Databases\Sqlite;
use Spatie\DbDumper\DbDumper;
use Spatie\DbDumper\Exceptions\CannotSetParameter;
/**
* Class DumpAction.
*/
abstract class DumpAction
{
/**
* Create a new action instance.
*
* @param array<string, mixed> $options
*/
public function __construct(protected readonly array $options = []) {}
@@ -42,8 +37,6 @@ abstract class DumpAction
/**
* Handle action.
*
* @return ActionResult
*
* @throws Exception
*/
public function handle(): ActionResult
@@ -92,9 +85,6 @@ abstract class DumpAction
/**
* Get the dumper for the database connection.
*
* @param Connection $connection
* @return DbDumper|null
*
* @throws CannotSetParameter
*/
protected function getDumper(Connection $connection): ?DbDumper
@@ -117,9 +107,6 @@ abstract class DumpAction
/**
* Configure Sqlite database dumper.
*
* @param Connection $connection
* @return Sqlite
*
* @throws RuntimeException
* @throws CannotSetParameter
*/
@@ -140,9 +127,6 @@ abstract class DumpAction
/**
* Configure MySQL database dumper.
*
* @param Connection $connection
* @return MySql
*
* @throws CannotSetParameter
*/
protected function prepareMySqlDumper(Connection $connection): MySql
@@ -226,9 +210,6 @@ abstract class DumpAction
/**
* Configure PostgreSql database dumper.
*
* @param Connection $connection
* @return PostgreSql
*
* @throws CannotSetParameter
*/
protected function preparePostgreSqlDumper(Connection $connection): PostgreSql
@@ -264,9 +245,6 @@ abstract class DumpAction
/**
* Determine if the string option is set.
*
* @param string $key
* @return bool
*/
protected function hasOption(string $key): bool
{
@@ -275,9 +253,6 @@ abstract class DumpAction
/**
* Get the option by key.
*
* @param string $key
* @return mixed
*/
protected function option(string $key): mixed
{
@@ -288,8 +263,6 @@ abstract class DumpAction
* The temporary path for the database dump.
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
* Pattern: "animethemes-db-dump-{concern}-{milliseconds from epoch}.sql".
*
* @return string
*/
abstract protected function getDumpFile(): string;
@@ -14,9 +14,6 @@ use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
* Class DumpAdminAction.
*/
class DumpAdminAction extends DumpAction
{
use ReconcilesDumpRepositories;
@@ -44,8 +41,6 @@ class DumpAdminAction extends DumpAction
* The temporary path for the database dump.
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
* Pattern: "animethemes-db-dump-admin-{milliseconds from epoch}.sql".
*
* @return string
*/
protected function getDumpFile(): string
{
@@ -13,9 +13,6 @@ use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
* Class DumpAuthAction.
*/
class DumpAuthAction extends DumpAction
{
use ReconcilesDumpRepositories;
@@ -48,8 +45,6 @@ class DumpAuthAction extends DumpAction
* The temporary path for the database dump.
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
* Pattern: "animethemes-db-dump-auth-{milliseconds from epoch}.sql".
*
* @return string
*/
protected function getDumpFile(): string
{
@@ -10,9 +10,6 @@ use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
* Class DumpDiscordAction.
*/
class DumpDiscordAction extends DumpAction
{
use ReconcilesDumpRepositories;
@@ -35,8 +32,6 @@ class DumpDiscordAction extends DumpAction
* The temporary path for the database dump.
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
* Pattern: "animethemes-db-dump-discord-{milliseconds from epoch}.sql".
*
* @return string
*/
protected function getDumpFile(): string
{
@@ -10,9 +10,6 @@ use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
* Class DumpDocumentAction.
*/
class DumpDocumentAction extends DumpAction
{
use ReconcilesDumpRepositories;
@@ -35,8 +32,6 @@ class DumpDocumentAction extends DumpAction
* The temporary path for the database dump.
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
* Pattern: "animethemes-db-dump-document-{milliseconds from epoch}.sql".
*
* @return string
*/
protected function getDumpFile(): string
{
@@ -14,9 +14,6 @@ use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
* Class DumpListAction.
*/
class DumpListAction extends DumpAction
{
use ReconcilesDumpRepositories;
@@ -43,8 +40,6 @@ class DumpListAction extends DumpAction
* The temporary path for the database dump.
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
* Pattern: "animethemes-db-dump-list-{milliseconds from epoch}.sql".
*
* @return string
*/
protected function getDumpFile(): string
{
@@ -15,9 +15,6 @@ use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
* Class DumpUserAction.
*/
class DumpUserAction extends DumpAction
{
use ReconcilesDumpRepositories;
@@ -45,8 +42,6 @@ class DumpUserAction extends DumpAction
* The temporary path for the database dump.
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
* Pattern: "animethemes-db-dump-user-{milliseconds from epoch}.sql".
*
* @return string
*/
protected function getDumpFile(): string
{
@@ -11,9 +11,6 @@ use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
* Class DumpViewAction.
*/
class DumpViewAction extends DumpAction
{
use ReconcilesDumpRepositories;
@@ -37,8 +34,6 @@ class DumpViewAction extends DumpAction
* The temporary path for the database dump.
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
* Pattern: "animethemes-db-dump-view-{milliseconds from epoch}.sql".
*
* @return string
*/
protected function getDumpFile(): string
{
@@ -37,9 +37,6 @@ use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
/**
* Class DumpWikiAction.
*/
class DumpWikiAction extends DumpAction
{
use ReconcilesDumpRepositories;
@@ -89,8 +86,6 @@ class DumpWikiAction extends DumpAction
* The temporary path for the database dump.
* Note: The dumper library does not support writing to disk, so we have to write to the local filesystem first.
* Pattern: "animethemes-db-dump-wiki-{milliseconds from epoch}.sql".
*
* @return string
*/
protected function getDumpFile(): string
{
@@ -13,17 +13,12 @@ use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Str;
/**
* Class PruneDumpAction.
*/
class PruneDumpAction extends PruneAction
{
use ReconcilesDumpRepositories;
/**
* The name of the disk.
*
* @return string
*/
public function disk(): string
{
@@ -32,10 +27,6 @@ class PruneDumpAction extends PruneAction
/**
* Determine whether the file should be pruned.
*
* @param string $path
* @param Carbon $lastModified
* @return bool
*/
protected function shouldBePruned(string $path, Carbon $lastModified): bool
{
@@ -19,16 +19,12 @@ use Illuminate\Support\Facades\Storage;
abstract class DeleteAction implements InteractsWithDisks, StorageAction
{
/**
* Create a new action instance.
*
* @param TModel $model
*/
public function __construct(protected BaseModel $model) {}
/**
* Handle action.
*
* @return StorageResults
*/
public function handle(): StorageResults
{
@@ -49,7 +45,6 @@ abstract class DeleteAction implements InteractsWithDisks, StorageAction
/**
* Processes to be completed after handling action.
*
* @param StorageResults $storageResults
* @return TModel
*/
public function then(StorageResults $storageResults): BaseModel
@@ -61,8 +56,6 @@ abstract class DeleteAction implements InteractsWithDisks, StorageAction
/**
* Get the path to delete.
*
* @return string
*/
abstract protected function path(): string;
}
@@ -12,23 +12,15 @@ use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
/**
* Class DeleteResults.
*/
readonly class DeleteResults implements StorageResults
{
/**
* Create a new action result instance.
*
* @param BaseModel $model
* @param array<string, bool> $deletions
*/
public function __construct(protected BaseModel $model, protected array $deletions = []) {}
/**
* Write results to log.
*
* @return void
*/
public function toLog(): void
{
@@ -44,9 +36,6 @@ readonly class DeleteResults implements StorageResults
/**
* Write results to console output.
*
* @param Command $command
* @return void
*/
public function toConsole(Command $command): void
{
@@ -62,8 +51,6 @@ readonly class DeleteResults implements StorageResults
/**
* Transform to Action Result.
*
* @return ActionResult
*/
public function toActionResult(): ActionResult
{
-7
View File
@@ -19,16 +19,12 @@ use Illuminate\Support\Facades\Storage;
abstract class MoveAction implements InteractsWithDisks, StorageAction
{
/**
* Create a new action instance.
*
* @param TModel $model
*/
public function __construct(protected BaseModel $model, protected readonly string $to) {}
/**
* Handle action.
*
* @return StorageResults
*/
public function handle(): StorageResults
{
@@ -51,7 +47,6 @@ abstract class MoveAction implements InteractsWithDisks, StorageAction
/**
* Processes to be completed after handling action.
*
* @param StorageResults $storageResults
* @return TModel
*/
public function then(StorageResults $storageResults): BaseModel
@@ -61,8 +56,6 @@ abstract class MoveAction implements InteractsWithDisks, StorageAction
/**
* Get the path to move from.
*
* @return string
*/
abstract protected function from(): string;
-15
View File
@@ -12,17 +12,9 @@ use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
/**
* Class MoveResults.
*/
readonly class MoveResults implements StorageResults
{
/**
* Create a new action result instance.
*
* @param BaseModel $model
* @param string $from
* @param string $to
* @param array<string, bool> $moves
*/
public function __construct(
@@ -34,8 +26,6 @@ readonly class MoveResults implements StorageResults
/**
* Write results to log.
*
* @return void
*/
public function toLog(): void
{
@@ -51,9 +41,6 @@ readonly class MoveResults implements StorageResults
/**
* Write results to console output.
*
* @param Command $command
* @return void
*/
public function toConsole(Command $command): void
{
@@ -69,8 +56,6 @@ readonly class MoveResults implements StorageResults
/**
* Transform to Action Result.
*
* @return ActionResult
*/
public function toActionResult(): ActionResult
{
-17
View File
@@ -13,24 +13,14 @@ use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Date;
use Illuminate\Support\Facades\Storage;
/**
* Class PruneAction.
*/
abstract class PruneAction implements InteractsWithDisk, StorageAction
{
use ReconcilesRepositories;
/**
* Create a new action instance.
*
* @param int $hours
*/
public function __construct(protected readonly int $hours = 72) {}
/**
* Handle action.
*
* @return StorageResults
*/
public function handle(): StorageResults
{
@@ -54,9 +44,6 @@ abstract class PruneAction implements InteractsWithDisk, StorageAction
/**
* Processes to be completed after handling action.
*
* @param StorageResults $storageResults
* @return null
*
* @throws Exception
*/
public function then(StorageResults $storageResults): null
@@ -70,10 +57,6 @@ abstract class PruneAction implements InteractsWithDisk, StorageAction
/**
* Determine whether the file should be pruned.
*
* @param string $path
* @param Carbon $lastModified
* @return bool
*/
abstract protected function shouldBePruned(string $path, Carbon $lastModified): bool;
}
-13
View File
@@ -11,23 +11,15 @@ use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
/**
* Class PruneResults.
*/
readonly class PruneResults implements StorageResults
{
/**
* Create a new action result instance.
*
* @param string $fs
* @param array<string, bool> $prunings
*/
public function __construct(protected string $fs, protected array $prunings = []) {}
/**
* Write results to log.
*
* @return void
*/
public function toLog(): void
{
@@ -43,9 +35,6 @@ readonly class PruneResults implements StorageResults
/**
* Write results to console output.
*
* @param Command $command
* @return void
*/
public function toConsole(Command $command): void
{
@@ -61,8 +50,6 @@ readonly class PruneResults implements StorageResults
/**
* Transform to Action Result.
*
* @return ActionResult
*/
public function toActionResult(): ActionResult
{
-11
View File
@@ -11,23 +11,12 @@ use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
/**
* Class UploadAction.
*/
abstract class UploadAction implements InteractsWithDisks, StorageAction
{
/**
* Create a new action instance.
*
* @param UploadedFile $file
* @param string $path
*/
public function __construct(protected readonly UploadedFile $file, protected readonly string $path) {}
/**
* Handle action.
*
* @return StorageResults
*/
public function handle(): StorageResults
{
@@ -11,22 +11,15 @@ use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
/**
* Class UploadResults.
*/
readonly class UploadResults implements StorageResults
{
/**
* Create a new action result instance.
*
* @param array<string, string|false> $uploads
*/
public function __construct(protected array $uploads = []) {}
/**
* Write results to log.
*
* @return void
*/
public function toLog(): void
{
@@ -42,9 +35,6 @@ readonly class UploadResults implements StorageResults
/**
* Write results to console output.
*
* @param Command $command
* @return void
*/
public function toConsole(Command $command): void
{
@@ -60,8 +50,6 @@ readonly class UploadResults implements StorageResults
/**
* Transform to Action Result.
*
* @return ActionResult
*/
public function toActionResult(): ActionResult
{
@@ -16,11 +16,6 @@ use Illuminate\Support\Facades\Config;
*/
class DeleteAudioAction extends DeleteAction
{
/**
* Create a new action instance.
*
* @param Audio $audio
*/
public function __construct(Audio $audio)
{
parent::__construct($audio);
@@ -28,8 +23,6 @@ class DeleteAudioAction extends DeleteAction
/**
* The list of disk names.
*
* @return array
*/
public function disks(): array
{
@@ -38,8 +31,6 @@ class DeleteAudioAction extends DeleteAction
/**
* Get the path to delete.
*
* @return string
*/
protected function path(): string
{
@@ -17,12 +17,6 @@ use Illuminate\Support\Facades\File;
*/
class MoveAudioAction extends MoveAction
{
/**
* Create a new action instance.
*
* @param Audio $audio
* @param string $to
*/
public function __construct(Audio $audio, string $to)
{
parent::__construct($audio, $to);
@@ -40,8 +34,6 @@ class MoveAudioAction extends MoveAction
/**
* Get the path to move from.
*
* @return string
*/
protected function from(): string
{
@@ -52,8 +44,6 @@ class MoveAudioAction extends MoveAction
* Update underlying model.
* We want to apply these updates through Eloquent to preserve relations when renaming.
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
*
* @return Audio
*/
protected function update(): Audio
{
@@ -12,16 +12,10 @@ use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
/**
* Class UploadAudioAction.
*/
class UploadAudioAction extends UploadAction
{
/**
* Processes to be completed after handling action.
*
* @param StorageResults $storageResults
* @return Audio|null
*/
public function then(StorageResults $storageResults): ?Audio
{
@@ -34,8 +28,6 @@ class UploadAudioAction extends UploadAction
/**
* Get existing or create new audio for file upload.
*
* @return Audio
*/
protected function getOrCreateAudio(): Audio
{
@@ -17,12 +17,6 @@ use Illuminate\Support\Facades\Config;
*/
class MoveImageAction extends MoveAction
{
/**
* Create a new action instance.
*
* @param Image $image
* @param string $to
*/
public function __construct(Image $image, string $to)
{
parent::__construct($image, $to);
@@ -40,8 +34,6 @@ class MoveImageAction extends MoveAction
/**
* Get the path to move from.
*
* @return string
*/
protected function from(): string
{
@@ -52,8 +44,6 @@ class MoveImageAction extends MoveAction
* Update underlying model.
* We want to apply these updates through Eloquent to preserve relations when renaming.
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
*
* @return Image
*/
protected function update(): Image
{
@@ -9,9 +9,6 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Process;
use Illuminate\Support\Str;
/**
* Class UploadedFileAction.
*/
class UploadedFileAction
{
/**
@@ -28,11 +25,6 @@ class UploadedFileAction
*/
public array $loudnessStats = [];
/**
* Create a new action instance.
*
* @param UploadedFile $file
*/
public function __construct(protected UploadedFile $file)
{
$this->setFFprobeData();
@@ -40,8 +32,6 @@ class UploadedFileAction
/**
* Set the FFprobe data for the uploaded file.
*
* @return void
*/
protected function setFFprobeData(): void
{
@@ -102,8 +92,6 @@ class UploadedFileAction
/**
* Get the resolution.
*
* @return int
*/
public function resolution(): int
{
@@ -147,9 +135,6 @@ class UploadedFileAction
/**
* Format FFprobe command.
*
* @param UploadedFile $file
* @return string
*/
public static function formatFfprobeCommand(UploadedFile $file): string
{
@@ -170,9 +155,6 @@ class UploadedFileAction
/**
* Format loudness command.
*
* @param UploadedFile $file
* @return string
*/
public static function formatLoudnessCommand(UploadedFile $file): string
{
@@ -16,11 +16,6 @@ use Illuminate\Support\Facades\Config;
*/
class DeleteVideoAction extends DeleteAction
{
/**
* Create a new action instance.
*
* @param Video $video
*/
public function __construct(Video $video)
{
parent::__construct($video);
@@ -38,8 +33,6 @@ class DeleteVideoAction extends DeleteAction
/**
* Get the path to delete.
*
* @return string
*/
protected function path(): string
{
@@ -17,12 +17,6 @@ use Illuminate\Support\Facades\File;
*/
class MoveVideoAction extends MoveAction
{
/**
* Create a new action instance.
*
* @param Video $video
* @param string $to
*/
public function __construct(Video $video, string $to)
{
parent::__construct($video, $to);
@@ -40,8 +34,6 @@ class MoveVideoAction extends MoveAction
/**
* Get the path to move from.
*
* @return string
*/
protected function from(): string
{
@@ -52,8 +44,6 @@ class MoveVideoAction extends MoveAction
* Update underlying model.
* We want to apply these updates through Eloquent to preserve relations when renaming.
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
*
* @return Video
*/
protected function update(): Video
{
@@ -17,11 +17,6 @@ use Illuminate\Support\Facades\Config;
*/
class DeleteScriptAction extends DeleteAction
{
/**
* Create a new action instance.
*
* @param VideoScript $script
*/
public function __construct(VideoScript $script)
{
parent::__construct($script);
@@ -39,8 +34,6 @@ class DeleteScriptAction extends DeleteAction
/**
* Get the path to delete.
*
* @return string
*/
protected function path(): string
{
@@ -17,12 +17,6 @@ use Illuminate\Support\Facades\Config;
*/
class MoveScriptAction extends MoveAction
{
/**
* Create a new action instance.
*
* @param VideoScript $script
* @param string $to
*/
public function __construct(VideoScript $script, string $to)
{
parent::__construct($script, $to);
@@ -40,8 +34,6 @@ class MoveScriptAction extends MoveAction
/**
* Get the path to move from.
*
* @return string
*/
protected function from(): string
{
@@ -52,8 +44,6 @@ class MoveScriptAction extends MoveAction
* Update underlying model.
* We want to apply these updates through Eloquent to preserve relations when renaming.
* Otherwise, reconciliation would destroy the old model and create a new model for the new name.
*
* @return VideoScript
*/
protected function update(): VideoScript
{
@@ -14,18 +14,8 @@ use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Str;
/**
* Class UploadScriptAction.
*/
class UploadScriptAction extends UploadAction
{
/**
* Create a new action instance.
*
* @param UploadedFile $file
* @param string $path
* @param Video|null $video
*/
public function __construct(UploadedFile $file, string $path, protected ?Video $video = null)
{
parent::__construct($file, $path);
@@ -33,9 +23,6 @@ class UploadScriptAction extends UploadAction
/**
* Processes to be completed after handling action.
*
* @param StorageResults $storageResults
* @return VideoScript|null
*/
public function then(StorageResults $storageResults): ?VideoScript
{
@@ -48,8 +35,6 @@ class UploadScriptAction extends UploadAction
/**
* Get existing or create new script for file upload.
*
* @return VideoScript
*/
protected function getOrCreateScript(): VideoScript
{
@@ -24,20 +24,10 @@ use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
/**
* Class UploadVideoAction.
*/
class UploadVideoAction extends UploadAction
{
/**
* Create a new action instance.
*
* @param UploadedFile $file
* @param string $path
* @param array $attributes
* @param AnimeThemeEntry|null $entry
* @param UploadedFile|null $script
* @param User|null $encoder
*/
public function __construct(
UploadedFile $file,
@@ -53,9 +43,6 @@ class UploadVideoAction extends UploadAction
/**
* Processes to be completed after handling action.
*
* @param StorageResults $storageResults
* @return Video|null
*
* @throws Exception
*/
public function then(StorageResults $storageResults): ?Video
@@ -89,8 +76,6 @@ class UploadVideoAction extends UploadAction
/**
* Get existing or create new video for file upload.
*
* @return Video
*/
protected function getOrCreateVideo(): Video
{
@@ -138,9 +123,6 @@ class UploadVideoAction extends UploadAction
/**
* Attach entry to created video if uploaded from entry detail screen.
*
* @param Video $video
* @return void
*/
protected function attachEntry(Video $video): void
{
@@ -151,9 +133,6 @@ class UploadVideoAction extends UploadAction
/**
* Upload & Associate Script if video upload was successful.
*
* @param Video $video
* @return void
*/
protected function uploadScript(Video $video): void
{
@@ -168,9 +147,6 @@ class UploadVideoAction extends UploadAction
/**
* Mark the encoder for the video.
*
* @param Video $video
* @return void
*/
protected function markEncode(Video $video): void
{
@@ -11,18 +11,10 @@ use App\Http\Api\Schema\Schema;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
/**
* Class AggregatesFields.
*/
trait AggregatesFields
{
/**
* Select aggregate fields for the query builder.
*
* @param Builder $builder
* @param Query $query
* @param Schema $schema
* @return Builder
*/
public function withAggregates(Builder $builder, Query $query, Schema $schema): Builder
{
@@ -35,11 +27,6 @@ trait AggregatesFields
/**
* Load aggregate fields for the model.
*
* @param Model $model
* @param Query $query
* @param Schema $schema
* @return Model
*/
public function loadAggregates(Model $model, Query $query, Schema $schema): Model
{

Some files were not shown because too many files have changed in this diff Show More