Failed Conditions
Push — master ( 814bec...e68911 )
by Sébastien
03:09
created

PathAssertionsTrait::ensureFileExists()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Soluble\MediaTools\Util\Assert;
6
7
use Soluble\MediaTools\Exception\FileNotFoundException;
8
9
trait PathAssertionsTrait
10
{
11
    /**
12
     * @throws FileNotFoundException
13
     */
14 5
    protected function ensureFileExists(string $file): void
15
    {
16 5
        if (!file_exists($file)) {
17 1
            throw new FileNotFoundException(sprintf('File "%s" does not exists or is not readable', $file));
18
        }
19 4
    }
20
}
21