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

Media::filesystem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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