Completed
Push — master ( 81ce9d...1672d9 )
by Oleg
03:54
created

OutputWriter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 28
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A write() 0 11 1
A __construct() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Writer;
5
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
class OutputWriter implements WriteInterface
9
{
10
    /**
11
     * @var OutputInterface
12
     */
13
    private $output;
14
    /**
15
     * @var FileNameProviderInterface
16
     */
17
    private $fileNameProvider;
18
19 3
    public function __construct(OutputInterface $output, FileNameProviderInterface $fileNameProvider)
20
    {
21 3
        $this->output = $output;
22 3
        $this->fileNameProvider = $fileNameProvider;
23 3
    }
24
25 3
    public function write(string $content): void
26
    {
27 3
        $fName = $this->fileNameProvider->getFileName($content);
28 3
        $this->output->writeln(
29 3
            sprintf('<comment>START FILE %s==================================================</comment>', $fName)
30
        );
31 3
        $this->output->writeln($content);
32 3
        $this->output->writeln(
33 3
            sprintf('<comment>END FILE %s####################################################</comment>', $fName)
34
        );
35 3
        $this->output->writeln("<comment>#\n#\n#\n#</comment>");
36 3
    }
37
}
38