DirectoryCheckerTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 18
ccs 3
cts 4
cp 0.75
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A configurationDirectoryExists() 0 7 2
1
<?php
2
3
namespace Mediadevs\Configuration\Traits;
4
5
use Mediadevs\Configuration\Exceptions\ConfigurationDirectoryException;
6
7
trait DirectoryCheckerTrait
8
{
9
    /**
10
     * Whether the configuration directory exists.
11
     *
12
     * @param string $path
13
     *
14
     * @throws ConfigurationDirectoryException
15
     *
16
     * @return bool
17
     */
18 2
    public function configurationDirectoryExists(string $path): bool
19
    {
20
        // An exception will be thrown if the directory doesn't exist
21 2
        if (is_dir($path)) {
22 2
            return true;
23
        } else {
24
            throw new ConfigurationDirectoryException();
25
        }
26
    }
27
}
28