FileSystem   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createProjectDirectory() 0 16 2
1
<?php
2
namespace PressCLI\Lib;
3
4
use Symfony\Component\Console\Output\OutputInterface;
5
6
trait FileSystem
7
{
8
    /**
9
     * Create project directory.
10
     *
11
     * @return InitCommand
12
     */
13
    protected function createProjectDirectory($directory, OutputInterface $output)
14
    {
15
        $output->writeln("<info>Creating project directory...</info>");
16
17
        if (file_exists($directory)) {
18
            $output->writeln("<comment>Project directory already exists at {$directory}.</comment>");
19
20
            return $this;
21
        }
22
23
        mkdir($directory, 0755, true);
24
25
        $output->writeln("<info>Project directory created at {$directory}!</info>");
26
27
        return $this;
28
    }
29
}
30