EnvFileExists::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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