MoveDefaultLaravelAssets   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\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