Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Nov 25, 2023
1 parent c712b1b commit 08a5dcf
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion config/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

// config for Finller/LaravelMedia
return [
'default_collection_name' => 'default'
'default_collection_name' => 'default',
];
3 changes: 1 addition & 2 deletions src/Enums/MediaType.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ enum MediaType: string
case Pdf = 'pdf';
case Other = 'other';


static function tryFromMimeType(string $mimeType)
public static function tryFromMimeType(string $mimeType)
{
if (str_starts_with($mimeType, 'video/')) {
return self::Video;
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class File
{
static function dimension(string $path, ?MediaType $type = null, ?string $mime_type = null): ?Dimension
public static function dimension(string $path, MediaType $type = null, string $mime_type = null): ?Dimension
{
$type ??= MediaType::tryFromMimeType($mime_type ?? mime_content_type($path));

Expand Down
5 changes: 3 additions & 2 deletions src/Helpers/HasDimension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

interface HasDimension
{
static function dimension(string $path): Dimension;
static function ratio(string $path, bool $forceStandards = true): AspectRatio;
public static function dimension(string $path): Dimension;

public static function ratio(string $path, bool $forceStandards = true): AspectRatio;
}
4 changes: 2 additions & 2 deletions src/Helpers/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class Image implements HasDimension
{
static function dimension(string $path): Dimension
public static function dimension(string $path): Dimension
{
$file = SpatieImage::load($path);

Expand All @@ -18,7 +18,7 @@ static function dimension(string $path): Dimension
);
}

static function ratio(string $path, bool $forceStandards = true): AspectRatio
public static function ratio(string $path, bool $forceStandards = true): AspectRatio
{
return static::dimension($path)->getRatio($forceStandards);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Helpers/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class Video implements HasDimension
{
static function dimension(string $path): Dimension
public static function dimension(string $path): Dimension
{
$file = FFProbe::create([
'ffmpeg.binaries' => config('laravel-ffmpeg.ffmpeg.binaries'),
Expand All @@ -23,12 +23,12 @@ static function dimension(string $path): Dimension
->getDimensions();
}

static function ratio(string $path, bool $forceStandards = true): AspectRatio
public static function ratio(string $path, bool $forceStandards = true): AspectRatio
{
return static::dimension($path)->getRatio($forceStandards);
}

static function duration(string $path): float
public static function duration(string $path): float
{
return FFMpeg::open($path)->getDurationInMiliseconds();
}
Expand Down
12 changes: 6 additions & 6 deletions src/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ public function addGeneratedConversion(string $name, GeneratedConversion $genera
return $this;
}

function humanReadableSize(): string
public function humanReadableSize(): string
{
return Number::fileSize($this->size);
}

function storeFileFromUpload(
public function storeFileFromUpload(
UploadedFile $file,
?string $collection_name = null,
?string $path = null,
?string $name = null,
?string $disk = null,
string $collection_name = null,
string $path = null,
string $name = null,
string $disk = null,
) {
$this->collection_name = $collection_name ?? $this->collection_name ?? config('media.default_collection_name');
$this->disk = $disk ?? $this->disk ?? config('filesystems.default');
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasUuid.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trait HasUuid
// });
// }

function initializeHasUuid()
public function initializeHasUuid()
{
if (blank($this->uuid)) {
$this->uuid = (string) Str::uuid();
Expand Down
1 change: 0 additions & 1 deletion tests/Feature/MediaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
expect($media->hasGeneratedConversion('poster.poster-optimized'))->toBe(true);
});


it('store an uploaded image', function () {
/** @var Media $media */
$media = MediaFactory::new()->make();
Expand Down

0 comments on commit 08a5dcf

Please sign in to comment.