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

Link   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getBody() 0 3 1
A __construct() 0 5 1
A bodyFields() 0 3 1
A validate() 0 6 1
1
<?php
2
3
namespace DingRobot\Message;
4
5
/**
6
 * Link
7
 *
8
 * @method Link title($title)
9
 * @method Link text($markdownText)
10
 * @method Link picUrl($picUrl)
11
 * @method Link messageUrl($messageUrl)
12
 *
13
 * @package DingRobot\Message
14
 */
15
class Link extends Base
16
{
17 1
    public function __construct($title = '')
18
    {
19 1
        parent::__construct();
20 1
        $this->title($title);
21 1
        $this->bodyName = 'link';
22 1
    }
23
24 1
    protected function getBody()
25
    {
26 1
        return $this->body;
27
    }
28
29 1
    protected function bodyFields()
30
    {
31 1
        return ['title', 'text', 'picUrl', 'messageUrl'];
32
    }
33
34 1
    protected function validate()
35
    {
36 1
        $this->check('title');
37 1
        $this->check('text');
38 1
        $this->check('picUrl', false);
39 1
        $this->check('messageUrl');
40
    }
41
}