LaravelLangBundlerCommand::buildPath()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 2
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
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