PbagCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A makeDir() 0 6 2
A replace() 0 3 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