EnvFileExists   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 44
ccs 5
cts 9
cp 0.5556
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A name() 0 4 1
A check() 0 4 1
A message() 0 4 1
1
<?php
2
3
namespace BeyondCode\SelfDiagnosis\Checks;
4
5
use Illuminate\Filesystem\Filesystem;
6
7
class EnvFileExists implements Check
8
{
9
10
    /** @var Filesystem */
11
    private $filesystem;
12
13 4
    public function __construct(Filesystem $filesystem)
14
    {
15 4
        $this->filesystem = $filesystem;
16 4
    }
17
18
    /**
19
     * The name of the check.
20
     *
21
     * @param array $config
22
     * @return string
23
     */
24
    public function name(array $config): string
25
    {
26
        return trans('self-diagnosis::checks.env_file_exists.name');
27
    }
28
29
    /**
30
     * Perform the actual verification of this check.
31
     *
32
     * @param array $config
33
     * @return bool
34
     */
35 4
    public function check(array $config): bool
36
    {
37 4
        return $this->filesystem->exists(base_path('.env'));
38
    }
39
40
    /**
41
     * The error message to display in case the check does not pass.
42
     *
43
     * @param array $config
44
     * @return string
45
     */
46
    public function message(array $config): string
47
    {
48
        return trans('self-diagnosis::checks.env_file_exists.message');
49
    }
50
}
51