Passed
Push — master ( b52452...60ff6d )
by Luca
04:00 queued 01:57
created

inputFileNotFoundOrNotReadable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 7
rs 10
1
<?php
2
3
namespace Jackal\Giffhanger\Exception;
4
5
class GiffhangerException extends \Exception
6
{
7
    public static function invalidExtension($extension) : GiffhangerException
8
    {
9
        return new GiffhangerException(sprintf('"%s" is not a valid extension', $extension));
10
    }
11
12
    public static function inputFileNotFoundOrNotReadable($filePath) : GiffhangerException
13
    {
14
        if (is_file($filePath)) {
15
            $filePath = realpath($filePath);
16
        }
17
18
        return new GiffhangerException(sprintf('File "%s" not found or not readable', $filePath));
19
    }
20
21
    public static function inputFileIsNotVideo($filePath, $mimeType) : GiffhangerException
22
    {
23
        return new GiffhangerException(sprintf('File "%s" is not a video file (actual mime-type: "%s")', $filePath, $mimeType));
24
    }
25
}
26