| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Pattern match exception. |
| 5 |
* |
| 6 |
* Please report bugs on https://github.com/matthiasmullie/minify/issues |
| 7 |
* |
| 8 |
* @author Ere Maijala <ere.maijala@helsinki.fi> |
| 9 |
* @copyright Copyright (c) 2012, Matthias Mullie. All rights reserved |
| 10 |
* @license MIT License |
| 11 |
*/ |
| 12 |
|
| 13 |
namespace MatthiasMullie\Minify\Exceptions; |
| 14 |
|
| 15 |
/** |
| 16 |
* Pattern Match Exception Class. |
| 17 |
* |
| 18 |
* @author Ere Maijala <ere.maijala@helsinki.fi> |
| 19 |
*/ |
| 20 |
class PatternMatchException extends BasicException |
| 21 |
{ |
| 22 |
/** |
| 23 |
* Create an exception from preg_last_error. |
| 24 |
* |
| 25 |
* @param string $msg Error message |
| 26 |
*/ |
| 27 |
public static function fromLastError($msg) |
| 28 |
{ |
| 29 |
$msg .= ': Error ' . preg_last_error(); |
| 30 |
if (PHP_MAJOR_VERSION >= 8) { |
| 31 |
$msg .= ' - ' . preg_last_error_msg(); |
| 32 |
} |
| 33 |
|
| 34 |
return new PatternMatchException($msg); |
| 35 |
} |
| 36 |
} |
| 37 |
|