Text   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 33
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A appendContent() 0 5 1
A __construct() 0 5 1
A bodyFields() 0 3 1
A getBody() 0 3 1
1
<?php
2
3
namespace DingRobot\Message;
4
5
/**
6
 * Text
7
 *
8
 * @method Text content($content)
9
 *
10
 * @package DingRobot\Message
11
 */
12
class Text extends Base
13
{
14
15 3
    public function __construct($content = '')
16
    {
17 3
        parent::__construct();
18 3
        $this->content($content);
19 3
        $this->bodyName = 'text';
20 3
    }
21
22 2
    protected function getBody()
23
    {
24 2
        return $this->body;
25
    }
26
27 3
    protected function bodyFields()
28
    {
29 3
        return ['content' => ['required' => true, 'type' => 'string']];
30
    }
31
32
    /**
33
     * append content
34
     * 追加内容
35
     *
36
     * @param string $content
37
     *
38
     * @return $this
39
     */
40 1
    public function appendContent($content = '')
41
    {
42 1
        $this->body['content'] .= $content;
43
44 1
        return $this;
45
    }
46
}