TopicMeta::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 7
c 2
b 1
f 0
nc 1
nop 0
dl 0
loc 11
ccs 0
cts 10
cp 0
crap 2
rs 10
1
<?php
2
3
namespace Freyo\LaravelQueueCMQ\Queue\Driver;
4
5
class TopicMeta
6
{
7
    // default maxMsgSize  65536
8
    // default msgRetentionSeconds 86400, one day
9
10
    /* 主题属性
11
    @note: 可修改
12
    :: maxMsgSize          消息最大值
13
14
    @note: 不可修改
15
    :: msgRetentionSeconds 消息最长保存时间,默认为 一天
16
    :: createTime          创建时间
17
    :: lastModifyTime      上次修改时间
18
    */
19
    public $maxMsgSize;
20
    public $msgRetentionSeconds;
21
    public $createTime;
22
    public $lastModifyTime;
23
24
    public function __construct()
25
    {
26
        $this->maxMsgSize = 65536;
27
        $this->msgRetentionSeconds = 86400;
28
        $this->createTime = 0;
29
        $this->lastModifyTime = 0;
30
        $this->filterType = 1;
0 ignored issues
show
Bug Best Practice introduced by
The property filterType does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
31
    }
32
33
    public function __toString()
34
    {
35
        $info = [
36
            'maxMsgSize'          => $this->maxMsgSize,
37
            'msgRetentionSeconds' => $this->msgRetentionSeconds,
38
            'createTime'          => $this->createTime,
39
            'lastModifyTime'      => $this->lastModifyTime,
40
            'filterType'          => $this->filterType,
41
        ];
42
43
        return json_encode($info);
44
    }
45
}
46