CMQExceptionBase::get_info()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
ccs 0
cts 6
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Freyo\LaravelQueueCMQ\Queue\Driver;
4
5
use RuntimeException;
6
7
class CMQExceptionBase extends RuntimeException
8
{
9
    /*
10
    @type code: int
0 ignored issues
show
Bug introduced by
The type Freyo\LaravelQueueCMQ\Queue\Driver\code was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
    @param code: 错误类型
12
13
    @type message: string
14
    @param message: 错误描述
15
16
    @type data: array
17
    @param data: 错误数据
18
    */
19
20
    public $code;
21
    public $message;
22
    public $data;
23
24
    public function __construct($message, $code = -1, $data = [])
25
    {
26
        parent::__construct($message, $code);
27
        $this->code = $code;
28
        $this->message = $message;
29
        $this->data = $data;
30
    }
31
32
    public function __toString()
33
    {
34
        return 'CMQExceptionBase  '.$this->get_info();
35
    }
36
37
    public function get_info()
38
    {
39
        $info = ['code'         => $this->code,
40
                      'data'    => json_encode($this->data),
41
                      'message' => $this->message, ];
42
43
        return json_encode($info);
44
    }
45
}
46