Failed Conditions
Push — master ( bd9fc8...d384bc )
by Sébastien
03:00
created

CommonAssertionsTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

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

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\Util;
6
7
use Soluble\MediaTools\Exception\FileNotFoundException;
8
9
trait CommonAssertionsTrait
10
{
11
    /**
12
     * @throws FileNotFoundException
13
     */
14 1
    protected function ensureFileExists(string $file): void
15
    {
16 1
        if (!file_exists($file)) {
17
            throw new FileNotFoundException(sprintf('File "%s" does not exists or is not readable', $file));
18
        }
19 1
    }
20
}
21