Completed
Push — master ( 098b56...4e0e81 )
by Stéphane
02:32
created

HTMLUtils::ensureEmptyDestination()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 6
ccs 0
cts 6
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php namespace Todaymade\Daux\Format\HTML;
2
3
use Todaymade\Daux\GeneratorHelper;
4
5
trait HTMLUtils {
6
    public function ensureEmptyDestination($destination)
7
    {
8
        if (is_dir($destination)) {
9
            GeneratorHelper::rmdir($destination);
10
        } else {
11
            mkdir($destination);
12
        }
13
    }
14
15
    /**
16
     * Copy all files from $local to $destination
17
     *
18
     * @param string $destination
19
     * @param string $local_base
20
     */
21
    public function copyThemes($destination, $local_base)
22
    {
23
        mkdir($destination . DIRECTORY_SEPARATOR . 'themes');
24
        GeneratorHelper::copyRecursive(
25
            $local_base,
26
            $destination . DIRECTORY_SEPARATOR . 'themes'
27
        );
28
    }
29
}