Completed
Push — master ( 2044f4...a35418 )
by Loïc
13s queued 11s
created

DirectoryChecker::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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