Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
66.67% |
4 / 6 |
|
33.33% |
1 / 3 |
CRAP | |
0.00% |
0 / 1 |
| WebPConvertException | |
66.67% |
4 / 6 |
|
33.33% |
1 / 3 |
4.59 | |
0.00% |
0 / 1 |
| getDetailedMessage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getShortMessage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
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 = ''; |
| 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 | public function __construct($shortMessage = "", $detailedMessage = "", $previous = null) |
| 33 | { |
| 34 | $detailedMessage = ($detailedMessage != '') ? $detailedMessage : $shortMessage; |
| 35 | $this->detailedMessage = $detailedMessage; |
| 36 | $this->shortMessage = $shortMessage; |
| 37 | |
| 38 | parent::__construct( |
| 39 | $detailedMessage, |
| 40 | 0, |
| 41 | $previous |
| 42 | ); |
| 43 | } |
| 44 | } |