StorageDirectoryIsLinked::message()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace BeyondCode\SelfDiagnosis\Checks;
4
5
use Illuminate\Filesystem\Filesystem;
6
7
class StorageDirectoryIsLinked implements Check
8
{
9
    /** @var Filesystem */
10
    private $filesystem;
11
12 4
    public function __construct(Filesystem $filesystem)
13
    {
14 4
        $this->filesystem = $filesystem;
15 4
    }
16
17
    /**
18
     * The name of the check.
19
     *
20
     * @param array $config
21
     * @return string
22
     */
23
    public function name(array $config): string
24
    {
25
        return trans('self-diagnosis::checks.storage_directory_is_linked.name');
26
    }
27
28
    /**
29
     * The error message to display in case the check does not pass.
30
     *
31
     * @param array $config
32
     * @return string
33
     */
34
    public function message(array $config): string
35
    {
36
        return trans('self-diagnosis::checks.storage_directory_is_linked.message');
37
    }
38
39
    /**
40
     * Perform the actual verification of this check.
41
     *
42
     * @param array $config
43
     * @return bool
44
     */
45 4
    public function check(array $config): bool
46
    {
47
        try {
48 4
            return $this->filesystem->isDirectory(public_path('storage'));
49
        } catch (\Exception $e) {
50
            return false;
51
        }
52
    }
53
}
54