Passed
Push — master ( ac7cac...af560c )
by Sébastien
02:21
created

PathAssertionsTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 9
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A ensureFileExists() 0 4 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Common\Assert;
6
7
use Soluble\MediaTools\Common\Exception\FileNotFoundException;
8
9
trait PathAssertionsTrait
10
{
11
    /**
12
     * @throws FileNotFoundException
13
     */
14 16
    protected function ensureFileExists(string $file): void
15
    {
16 16
        if (!file_exists($file)) {
17 4
            throw new FileNotFoundException(sprintf('File "%s" does not exists or is not readable', $file));
18
        }
19 12
    }
20
}
21