GiffhangerException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 6
c 2
b 0
f 1
dl 0
loc 19
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidExtension() 0 3 1
A inputFileNotFoundOrNotReadable() 0 7 2
A inputFileIsNotVideo() 0 3 1
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