Completed
Pull Request — master (#3)
by ARCANEDEV
08:48
created

Media   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 79
c 0
b 0
f 0
wmc 5
lcom 1
cbo 3
ccs 13
cts 13
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A filesystem() 0 4 1
A config() 0 4 1
A disk() 0 4 1
A defaultDisk() 0 6 1
1
<?php namespace Arcanesoft\Media;
2
3
use Arcanesoft\Media\Contracts\Media as MediaContract;
4
use Illuminate\Contracts\Foundation\Application;
5
6
/**
7
 * Class     Media
8
 *
9
 * @package  Arcanesoft\Media
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class Media implements MediaContract
13
{
14
    /* ------------------------------------------------------------------------------------------------
15
     |  Properties
16
     | ------------------------------------------------------------------------------------------------
17
     */
18
    /**
19
     * The application instance.
20
     *
21
     * @var \Illuminate\Contracts\Foundation\Application
22
     */
23
    protected $app;
24
25
    /* ------------------------------------------------------------------------------------------------
26
     |  Constructor
27
     | ------------------------------------------------------------------------------------------------
28
     */
29
    /**
30
     * Media constructor.
31
     *
32
     * @param  \Illuminate\Contracts\Foundation\Application  $app
33
     */
34 6
    public function __construct(Application $app)
35
    {
36 6
        $this->app = $app;
37 6
    }
38
39
    /* ------------------------------------------------------------------------------------------------
40
     |  Getters & Setters
41
     | ------------------------------------------------------------------------------------------------
42
     */
43
    /**
44
     * Get the Filesystem Manager instance.
45
     *
46
     * @return \Illuminate\Contracts\Filesystem\Factory
47
     */
48 3
    public function filesystem()
49
    {
50 3
        return $this->app->make('filesystem');
51
    }
52
53
    /**
54
     * Get the Config Repository.
55
     *
56
     * @return \Illuminate\Contracts\Config\Repository
57
     */
58 3
    protected function config()
59
    {
60 3
        return $this->app->make('config');
61
    }
62
63
    /* ------------------------------------------------------------------------------------------------
64
     |  Main Functions
65
     | ------------------------------------------------------------------------------------------------
66
     */
67
    /**
68
     * Get a filesystem adapter.
69
     *
70
     * @param  string|null  $driver
71
     *
72
     * @return \Illuminate\Contracts\Filesystem\Filesystem
73
     */
74 3
    public function disk($driver = null)
75
    {
76 3
        return $this->filesystem()->disk($driver);
77
    }
78
79
    /**
80
     * Get the default filesystem adapter.
81
     *
82
     * @return \Illuminate\Contracts\Filesystem\Filesystem
83
     */
84 3
    public function defaultDisk()
85
    {
86 3
        return $this->disk(
87 3
            $this->config()->get('arcanesoft.media.filesystem.default')
88 2
        );
89
    }
90
}
91