Passed
Push — master ( bf86e6...5ea322 )
by Sébastien
07:21
created

PathAssertionsTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

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