CopyPresetDirectories::getResources()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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