Completed
Push — master ( 6b0faa...f8ec08 )
by Derek Stephen
08:21 queued 05:32
created

AssetManager::setDestinationFolder()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Del\Booty;
4
5
class AssetManager
6
{
7
    /** @var string[] $assetFolders */
8
    private $assetFolders = [];
9
10
    /** @var string $destinationFolder */
11
    private $destinationFolder = '';
12
13
    /** @var array $deployInfo */
14
    private $deployInfo = [];
15
16
    /**
17
     * @return string
18
     */
19
    public function addAssetsFolder(string $key, string $dir): void
20
    {
21
        $dir = realpath($dir);
22
23
        if (is_dir($dir)) {
24
            $this->assetFolders[$key] = $dir;
25
        }
26
    }
27
28
    /**
29
     * @return string
30
     */
31
    public function setDestinationFolder(string $dir): void
32
    {
33
        $dir = realpath($dir);
34
35
        if (is_dir($dir)) {
36
            $this->destinationFolder = $dir;
37
        }
38
    }
39
40
    /**
41
     * @return bool
42
     */
43
    public function deployAssets(): bool
44
    {
45
        foreach ($this->assetFolders as $key => $dir) {
46
            symlink($dir, $this->destinationFolder . '/' . $key);
47
        }
48
49
        return true;
50
    }
51
}