Passed
Push — master ( 481714...398263 )
by Chema
01:30 queued 13s
created

ConsoleFacade   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 13
c 0
b 0
f 0
dl 0
loc 34
ccs 0
cts 16
cp 0
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A parseArguments() 0 5 1
A generateFileContent() 0 8 1
A sanitizeFilename() 0 5 1
A clearCacheFile() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Console;
6
7
use Gacela\Console\Domain\CommandArguments\CommandArguments;
8
use Gacela\Framework\AbstractFacade;
9
10
/**
11
 * @method ConsoleFactory getFactory()
12
 */
13
final class ConsoleFacade extends AbstractFacade
14
{
15
    public function sanitizeFilename(string $filename): string
16
    {
17
        return $this->getFactory()
18
            ->createFilenameSanitizer()
19
            ->sanitize($filename);
20
    }
21
22
    public function parseArguments(string $desiredNamespace): CommandArguments
23
    {
24
        return $this->getFactory()
25
            ->createCommandArgumentsParser()
26
            ->parse($desiredNamespace);
27
    }
28
29
    public function generateFileContent(
30
        CommandArguments $commandArguments,
31
        string $filename,
32
        bool $withShortName = false
33
    ): string {
34
        return $this->getFactory()
35
            ->createFileContentGenerator()
36
            ->generate($commandArguments, $filename, $withShortName);
37
    }
38
39
    /**
40
     * @return list<string> the removed file paths
41
     */
42
    public function clearCacheFile(): array
43
    {
44
        return $this->getFactory()
45
            ->createCacheClearer()
46
            ->clearCacheFiles();
47
    }
48
}
49