LaravelLangBundlerCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A buildPath() 0 12 3
1
<?php
2
3
namespace LaravelLangBundler\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Filesystem\Filesystem;
7
8
class LaravelLangBundlerCommand extends Command
9
{
10
    /**
11
     * Filesystem instance.
12
     *
13
     * @var \Illuminate\Filesystem\Filesystem
14
     */
15
    protected $filesystem;
16
17
    /**
18
     * Set up command dependencies.
19
     */
20
    protected function setUp()
21
    {
22
        $this->filesystem = new Filesystem();
23
    }
24
25
    /**
26
     * Build path from path array.
27
     *
28
     * @param array  $pathArray
29
     * @param string $path
30
     *
31
     * @return string
32
     */
33
    protected function buildPath($pathArray, $path)
34
    {
35
        foreach ($pathArray as $directory) {
36
            $path .= $directory.DIRECTORY_SEPARATOR;
37
38
            if (!$this->filesystem->exists($path)) {
39
                $this->filesystem->makeDirectory($path);
40
            }
41
        }
42
43
        return $path;
44
    }
45
}
46