DirectoryChecker   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A ensureDirectoryExistsAndIsWritable() 0 8 1
1
<?php
2
3
/*
4
 * This file is part of monofony.
5
 *
6
 * (c) Mobizel
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace App\Command\Helper;
15
16
use App\Installer\Checker\CommandDirectoryChecker;
17
use Symfony\Component\Console\Output\OutputInterface;
18
19
class DirectoryChecker
20
{
21
    /** @var CommandDirectoryChecker */
22
    private $commandDirectoryChecker;
23
24
    public function __construct(CommandDirectoryChecker $commandDirectoryChecker)
25
    {
26
        $this->commandDirectoryChecker = $commandDirectoryChecker;
27
    }
28
29
    public function ensureDirectoryExistsAndIsWritable(string $directory, OutputInterface $output, string $commandName): void
30
    {
31
        $checker = $this->commandDirectoryChecker;
32
        $checker->setCommandName($commandName);
33
34
        $checker->ensureDirectoryExists($directory, $output);
35
        $checker->ensureDirectoryIsWritable($directory, $output);
36
    }
37
}
38