Completed
Push — master ( f02869...8251a6 )
by Nicolas
03:31
created

ProtectInstaller   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fire() 0 6 3
1
<?php namespace Modules\Core\Console\Installers\Scripts;
2
3
use Exception;
4
use Illuminate\Console\Command;
5
use Illuminate\Filesystem\Filesystem;
6
use Modules\Core\Console\Installers\SetupScript;
7
8
class ProtectInstaller implements SetupScript
9
{
10
    /**
11
     * @var Filesystem
12
     */
13
    protected $finder;
14
15
    /**
16
     * @param Filesystem $finder
17
     */
18
    public function __construct(Filesystem $finder)
19
    {
20
        $this->finder = $finder;
21
    }
22
23
    /**
24
     * Fire the install script
25
     * @param  Command   $command
26
     * @return mixed
27
     * @throws Exception
28
     */
29
    public function fire(Command $command)
30
    {
31
        if ($this->finder->isFile('.env') && ! $command->option('force')) {
32
            throw new Exception('Asgard has already been installed. You can already log into your administration.');
33
        }
34
    }
35
}
36