Failed Conditions
Push — master ( c8847f...26090e )
by Sébastien
03:53
created

CommonAssertionsTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 9
ccs 3
cts 3
cp 1
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 4
    protected function ensureFileExists(string $file): void
15
    {
16 4
        if (!file_exists($file)) {
17 1
            throw new FileNotFoundException(sprintf('File "%s" does not exists or is not readable', $file));
18
        }
19 3
    }
20
}
21