Text::appendContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
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
}