MoveDefaultLaravelAssets::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\Init;
2
3
use Closure;
4
use Illuminate\Support\Facades\File;
5
6
/**
7
 * Class     MoveDefaultLaravelAssets
8
 *
9
 * @package  Arcanedev\Assets\Pipes\Init
10
 * @author   ARCANEDEV <[email protected]>
11
 */
12
class MoveDefaultLaravelAssets extends AbstractPipe
13
{
14
    /* -----------------------------------------------------------------
15
     |  Main Method
16
     | -----------------------------------------------------------------
17
     */
18
19
    /**
20
     * @param  array     $passable
21
     * @param  \Closure  $next
22
     *
23
     * @return mixed
24
     */
25
    public function handle(array $passable, Closure $next)
26
    {
27
        foreach ($this->getResources($passable) as $from => $to) {
28
            File::moveDirectory($from, $to);
29
        }
30
31
        return $next($passable);
32
    }
33
34
    /* -----------------------------------------------------------------
35
     |  Other Methods
36
     | -----------------------------------------------------------------
37
     */
38
39
    /**
40
     * Get the resources paths.
41
     *
42
     * @param  array  $passable
43
     *
44
     * @return array
45
     */
46
    protected function getResources(array $passable)
47
    {
48
        return [
49
            resource_path('js')   => base_path($passable['path'].'/js'),
50
            resource_path('sass') => base_path($passable['path'].'/sass'),
51
        ];
52
    }
53
}
54