Passed
Branch feature/refactoring-samurai (b4e88e)
by Giuliano
03:41
created

ThemePublisher::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Maestriam\Samurai\Foundation;
4
5
use Illuminate\Support\Facades\File;
6
use Maestriam\Samurai\Entities\Theme;
7
8
class ThemePublisher
9
{
10
    private Theme $themeInstance;
11
12
    public function __construct(Theme $theme)
13
    {
14
        $this->setTheme($theme);
15
    }    
16
17
    public function publish()
18
    {
19
        $from = $this->theme()->paths()->assets();
20
        $to   = $this->theme()->paths()->public();
21
22
        File::copyDirectory($from, $to);
23
24
        return (is_dir($to)) ? true : false;
25
    }
26
27
    private function theme() : Theme 
28
    {
29
        return $this->themeInstance;
30
    }
31
32
    private function setTheme(Theme $theme) : ThemePublisher
33
    {
34
        $this->themeInstance = $theme;
35
        return $this;        
36
    }
37
}