Completed
Branch master (a6481d)
by Fèvre
02:09
created

XetaravelPathGenerator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPath() 0 4 1
A getPathForConversions() 0 4 1
1
<?php
2
namespace Xetaravel\MediaLibrary\PathGenerator;
3
4
use Spatie\MediaLibrary\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