Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze authored and github-actions[bot] committed Oct 24, 2023
1 parent a639108 commit 0d4b30f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/MediaCollections/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

namespace Spatie\MediaLibrary\MediaCollections;

use Exception;
use Illuminate\Contracts\Filesystem\Factory;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Spatie\MediaLibrary\Conversions\ConversionCollection;
use Spatie\MediaLibrary\Conversions\FileManipulator;
use Spatie\MediaLibrary\Support\FileRemover\FileRemoverFactory;
use Spatie\MediaLibrary\MediaCollections\Events\MediaHasBeenAdded;
use Spatie\MediaLibrary\MediaCollections\Exceptions\DiskCannotBeAccessed;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\MediaLibrary\Support\File;
use Spatie\MediaLibrary\Support\FileRemover\FileRemoverFactory;
use Spatie\MediaLibrary\Support\PathGenerator\PathGeneratorFactory;
use Spatie\MediaLibrary\Support\RemoteFile;

Expand Down
5 changes: 3 additions & 2 deletions src/Support/FileRemover/DefaultFileRemover.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
namespace Spatie\MediaLibrary\Support\FileRemover;

use Exception;
use Illuminate\Support\Str;
use Illuminate\Contracts\Filesystem\Factory;
use Illuminate\Support\Str;
use Spatie\MediaLibrary\MediaCollections\Filesystem;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

class DefaultFileRemover implements FileRemover
{
public function __construct(protected Filesystem $mediaFileSystem, protected Factory $filesystem)
{}
{
}

public function removeAllFiles(Media $media): void
{
Expand Down
5 changes: 2 additions & 3 deletions src/Support/FileRemover/FileBaseFileRemover.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
use Illuminate\Contracts\Filesystem\Factory;
use Spatie\MediaLibrary\MediaCollections\Filesystem;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\MediaLibrary\Support\FileRemover\FileRemover;
use Spatie\MediaLibrary\Support\FileRemover\DefaultFileRemover;

class FileBaseFileRemover extends DefaultFileRemover implements FileRemover
{
public function __construct(protected Filesystem $mediaFileSystem, protected Factory $filesystem)
{}
{
}

public function removeAllFiles(Media $media): void
{
Expand Down
6 changes: 3 additions & 3 deletions src/Support/FileRemover/FileRemoverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Spatie\MediaLibrary\Support\FileRemover;

use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\MediaLibrary\MediaCollections\Exceptions\InvalidFileRemover;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

class FileRemoverFactory
{
Expand All @@ -18,11 +18,11 @@ public static function create(Media $media): FileRemover

protected static function guardAgainstInvalidFileRemover(string $fileRemoverClass): void
{
if (!class_exists($fileRemoverClass)) {
if (! class_exists($fileRemoverClass)) {
throw InvalidFileRemover::doesntExist($fileRemoverClass);
}

if (!is_subclass_of($fileRemoverClass, FileRemover::class)) {
if (! is_subclass_of($fileRemoverClass, FileRemover::class)) {
throw InvalidFileRemover::doesNotImplementFileRemover($fileRemoverClass);
}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Feature/Media/DeleteTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\MediaLibrary\Tests\TestSupport\TestModels\TestModel;
use Spatie\MediaLibrary\Tests\TestSupport\TestPathGenerator;
use Spatie\MediaLibrary\Support\FileRemover\FileBaseFileRemover;
use Spatie\MediaLibrary\Tests\Support\PathGenerator\CustomDirectoryStructurePathGenerator;
use Spatie\MediaLibrary\Tests\TestSupport\TestModels\TestModel;
use Spatie\MediaLibrary\Tests\TestSupport\TestPathGenerator;

it('will remove the files when deleting an object that has media', function () {
$media = $this->testModel->addMedia($this->getTestJpg())->toMediaCollection('images');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public function getPathForResponsiveImages(Media $media): string
{
return $this->getPath($media) . 'cri/';
}
}
}

0 comments on commit 0d4b30f

Please sign in to comment.