Passed
Push — union-types ( b56600 )
by Luis
14:03
created

SaveFile   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 4 1
A __construct() 0 5 1
1
<?php declare(strict_types=1);
2
/**
3
 * PHP version 7.4
4
 *
5
 * This source file is subject to the license that is bundled with this package in the file LICENSE.
6
 */
7
8
namespace PhUml\Stages;
9
10
use PhUml\Processors\OutputContent;
11
use PhUml\Processors\OutputFilePath;
12
use PhUml\Processors\OutputWriter;
13
14
final class SaveFile
15
{
16
    private OutputWriter $writer;
17
18
    private OutputFilePath $path;
19
20
    private ProgressDisplay $display;
21
22
    public function __construct(OutputWriter $writer, OutputFilePath $path, ProgressDisplay $display)
23
    {
24
        $this->writer = $writer;
25
        $this->path = $path;
26
        $this->display = $display;
27
    }
28
29
    public function __invoke(OutputContent $content): void
30
    {
31
        $this->display->savingResult();
32
        $this->writer->save($content, $this->path);
33
    }
34
}
35