Passed
Push — master ( a7fcca...216d44 )
by Mike
02:49
created

FileCheckerTrait   A

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 configurationFileExists() 0 7 2
1
<?php
2
3
namespace Mediadevs\Configuration\Traits;
4
5
use Mediadevs\Configuration\Exceptions\ConfigurationFileException;
6
7
trait FileCheckerTrait
8
{
9
    /**
10
     * Whether the configuration file exists.
11
     *
12
     * @param string $file
13
     *
14
     * @throws ConfigurationFileException
15
     *
16
     * @return bool
17
     */
18 2
    public function configurationFileExists(string $file): bool
19
    {
20
        // An exception will be thrown if the file doesn't exist
21 2
        if (file_exists($file)) {
22 2
            return true;
23
        } else {
24
            throw new ConfigurationFileException();
25
        }
26
    }
27
}
28