Completed
Push — master ( 6caa0a...9b25f2 )
by Tomáš
12s
created

FileSystemWriter::copyStaticFiles()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 8
cp 0
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 6
1
<?php
2
3
/*
4
 * This file is a part of Sculpin.
5
 *
6
 * (c) Dragonfly Development Inc.
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
namespace Symplify\PHP7_Sculpin\Output;
13
14
use Nette\Utils\FileSystem;
15
16
final class FileSystemWriter
17
{
18
    /**
19
     * @var string
20
     */
21
    private $sourceDirectory;
22
23
    /**
24
     * @var string
25
     */
26
    private $outputDirectory;
27
28
    public function __construct(string $sourceDirectory, string $outputDirectory)
29
    {
30
        $this->sourceDirectory = $sourceDirectory;
31
        $this->outputDirectory = $outputDirectory;
32
    }
33
34
    public function copyStaticFiles(array $fileInfos)
35
    {
36
        foreach ($fileInfos as $fileInfo) {
37
            $relativeDestination = substr($fileInfo->getPathname(), strlen($this->sourceDirectory));
38
            $absoluteDestination = $this->outputDirectory . $relativeDestination;
39
40
            FileSystem::copy($fileInfo->getRealPath(), $absoluteDestination, true);
41
        }
42
    }
43
44
    // FileSystem::createDir(dirname($outputPath));
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
45
    // file_put_contents($outputPath, $output->formattedContent());
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
46
}
47