configurationDirectoryExists()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

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