BaseDriver   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 1
createFilesystem() 0 1 ?
1
<?php
2
/**
3
 * @link https://github.com/phpviet/laravel-flysystem
4
 * @copyright (c) PHP Viet
5
 * @license [MIT](http://www.opensource.org/licenses/MIT)
6
 */
7
8
namespace PHPViet\Laravel\Flysystem\Drivers;
9
10
use League\Flysystem\FilesystemInterface;
11
use Illuminate\Contracts\Foundation\Application;
12
13
/**
14
 * @author Vuong Minh <[email protected]>
15
 * @since 1.0.0
16
 */
17
abstract class BaseDriver
18
{
19
    /**
20
     * @var Application
21
     */
22
    protected $app;
23
24
    /**
25
     * @var array
26
     */
27
    protected $config;
28
29
    /**
30
     * Khởi tạo đối tượng Filesystem thông qua callable.
31
     *
32
     * @param  \Illuminate\Contracts\Foundation\Application  $app
33
     * @param  array  $config
34
     * @return \League\Flysystem\FilesystemInterface
35
     */
36
    public function __invoke(Application $app, array $config): FilesystemInterface
37
    {
38
        $this->app = $app;
39
        $this->config = $config;
40
41
        return $this->createFilesystem();
42
    }
43
44
    /**
45
     * Phương thức trừu tượng tạo Filesystem theo config chỉ định.
46
     *
47
     * @return \League\Flysystem\FilesystemInterface
48
     */
49
    abstract protected function createFilesystem(): FilesystemInterface;
50
}
51