StorageDirectoryIsLinked   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 45.45%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 47
ccs 5
cts 11
cp 0.4545
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 message() 0 4 1
A check() 0 8 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