luolongfei /
freenom
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * 业务逻辑异常时抛出 |
||||
| 4 | * |
||||
| 5 | * @author mybsdc <[email protected]> |
||||
| 6 | * @date 2018/8/10 |
||||
| 7 | * @time 14:48 |
||||
| 8 | */ |
||||
| 9 | |||||
| 10 | namespace Luolongfei\App\Exceptions; |
||||
| 11 | |||||
| 12 | class LlfException extends \Exception |
||||
| 13 | { |
||||
| 14 | public function __construct($code, $additional = null, \Exception $previous = null) |
||||
| 15 | { |
||||
| 16 | $message = lang('exception_msg.' . $code) ?: ''; |
||||
| 17 | |||||
| 18 | if ($additional !== null) { |
||||
| 19 | if (is_array($additional)) { |
||||
| 20 | array_unshift($additional, $message); |
||||
| 21 | $message = call_user_func_array('sprintf', $additional); |
||||
| 22 | } else if (is_string($additional)) { |
||||
| 23 | $message = sprintf($message, $additional); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 24 | } |
||||
| 25 | } |
||||
| 26 | |||||
| 27 | parent::__construct($message . "(Error code: {$code})", $code, $previous); |
||||
|
0 ignored issues
–
show
Are you sure
$message of type array|mixed|string can be used in concatenation?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 28 | } |
||||
| 29 | } |