PbagCommand::makeDir()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace LaravelPropertyBag\Commands;
4
5
use Illuminate\Console\Command;
6
use Illuminate\Support\Facades\File;
7
8
class PbagCommand extends Command
9
{
10
    /**
11
     * Make directory if it doesn't already exist.
12
     *
13
     * @param string $dir
14
     */
15
    protected function makeDir($dir)
16
    {
17
        $dirPath = base_path('app/'.ltrim($dir, '/'));
18
19
        if (!File::exists($dirPath)) {
20
            File::makeDirectory($dirPath);
21
        }
22
    }
23
24
    /**
25
     * Replace mustache with replacement in file.
26
     *
27
     * @param string $mustache
28
     * @param string $replacement
29
     * @param string $file
30
     *
31
     * @return string
32
     */
33
    protected function replace($mustache, $replacement, $file)
34
    {
35
        return str_replace($mustache, $replacement, $file);
36
    }
37
}
38