Completed
Push — issue-37 ( 46b1e6...b187aa )
by Fèvre
04:23
created

getPathForResponsiveImages()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
namespace Xetaravel\MediaLibrary\PathGenerator;
3
4
use Spatie\MediaLibrary\Models\Media;
5
use Spatie\MediaLibrary\PathGenerator\PathGenerator;
6
7
class XetaravelPathGenerator implements PathGenerator
8
{
9
    /**
10
     * Get the path for the given media, relative to the root storage path.
11
     *
12
     * @return string
13
     */
14
    public function getPath(Media $media) : string
15
    {
16
        return $media->collection_name . '/' . $media->id . '/';
17
    }
18
19
    /**
20
     * Get the path for conversions of the given media, relative to the root storage path.
21
     *
22
     * @return string
23
     */
24
    public function getPathForConversions(Media $media) : string
25
    {
26
        return $this->getPath($media) . 'conversions/';
27
    }
28
29
    /*
30
     * Get the path for responsive images of the given media, relative to the root storage path.
31
     *
32
     * @param \Spatie\MediaLibrary\Models\Media $media
33
     *
34
     * @return string
35
     */
36
    public function getPathForResponsiveImages(Media $media): string
37
    {
38
        return $this->getPath($media) . 'conversions/';
39
    }
40
}
41