Passed
Push — master ( 26c56b...7d441f )
by Bjørn
08:31
created

WebPConvertException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 26
ccs 8
cts 12
cp 0.6667
rs 10
c 0
b 0
f 0
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getShortMessage() 0 3 1
A getDetailedMessage() 0 3 1
A __construct() 0 10 2
1
<?php
2
3
namespace WebPConvert\Exceptions;
4
5
/**
6
 *  WebPConvertException is the base exception for all exceptions in this library.
7
 *
8
 *  Note that the parameters for the constructor differs from that of the Exception class.
9
 *  We do not use exception code here, but are instead allowing two version of the error message:
10
 *  a short version and a long version.
11
 *  The short version may not contain special characters or dynamic content.
12
 *  The detailed version may.
13
 *  If the detailed version isn't provided, getDetailedMessage will return the short version.
14
 *
15
 */
16
class WebPConvertException extends \Exception
17
{
18
    public $description = 'The converter failed converting, although requirements seemed to be met';
19
    protected $detailedMessage;
20
    protected $shortMessage;
21
22
    public function getDetailedMessage()
23
    {
24
        return $this->detailedMessage;
25
    }
26
27
    public function getShortMessage()
28
    {
29
        return $this->shortMessage;
30
    }
31
32 24
    public function __construct($shortMessage = "", $detailedMessage = "", $previous = null)
33
    {
34 24
        $detailedMessage = ($detailedMessage != '') ? $detailedMessage : $shortMessage;
35 24
        $this->detailedMessage = $detailedMessage;
36 24
        $this->shortMessage = $shortMessage;
37
38 24
        parent::__construct(
39 24
            $detailedMessage,
40 24
            0,
41 24
            $previous
42
        );
43 24
    }
44
}
45