CopyPresetDirectories   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 42
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 2
A getResources() 0 7 1
1
<?php namespace Arcanedev\Assets\Pipes\Presets\Tailwind;
2
3
use Arcanedev\Assets\Helpers\Stub;
4
use Closure;
5
use Illuminate\Support\Facades\File;
6
7
/**
8
 * Class     CopyPresetDirectories
9
 *
10
 * @package  Arcanedev\Assets\Pipes\Presets\Tailwind
11
 * @author   ARCANEDEV <[email protected]>
12
 */
13
class CopyPresetDirectories
14
{
15
    /* -----------------------------------------------------------------
16
     |  Main Method
17
     | -----------------------------------------------------------------
18
     */
19
20
    /**
21
     * @param  array     $passable
22
     * @param  \Closure  $next
23
     *
24
     * @return mixed
25
     */
26
    public function handle(array $passable, Closure $next)
27
    {
28
        foreach ($this->getResources($passable) as $from => $to) {
29
            File::copyDirectory($from, $to);
30
        }
31
32
        return $next($passable);
33
    }
34
35
    /* -----------------------------------------------------------------
36
     |  Other Methods
37
     | -----------------------------------------------------------------
38
     */
39
40
    /**
41
     * Get the preset resources.
42
     *
43
     * @param  array  $passable
44
     *
45
     * @return array
46
     */
47
    protected function getResources(array $passable)
48
    {
49
        return [
50
            Stub::path('presets/tailwind/js')  => base_path($passable['path'].'/js'),
51
            Stub::path('presets/tailwind/css') => base_path($passable['path'].'/css'),
52
        ];
53
    }
54
}
55