Completed
Push — master ( 8760fe...a207da )
by Hao
06:39 queued 03:50
created

Text::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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 1
    public function __construct($content = '')
16
    {
17 1
        parent::__construct();
18 1
        $this->content($content);
19 1
        $this->bodyName = 'text';
20 1
    }
21
22 1
    protected function getBody()
23
    {
24 1
        return $this->body;
25
    }
26
27 1
    protected function bodyFields()
28
    {
29 1
        return ['content'];
30
    }
31
32 1
    protected function validate()
33
    {
34 1
        $this->check('content', true);
35 1
    }
36
37
    /**
38
     * append content
39
     * 追加内容
40
     *
41
     * @param string $content
42
     *
43
     * @return $this
44
     */
45 1
    public function appendContent($content = '')
46
    {
47 1
        $this->body['content'] .= $content;
48
49 1
        return $this;
50
    }
51
}