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

OutputWriter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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