Link   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getBody() 0 3 1
A __construct() 0 5 1
A bodyFields() 0 7 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 2
    public function __construct($title = '')
18
    {
19 2
        parent::__construct();
20 2
        $this->title($title);
21 2
        $this->bodyName = 'link';
22 2
    }
23
24 1
    protected function getBody()
25
    {
26 1
        return $this->body;
27
    }
28
29 2
    protected function bodyFields()
30
    {
31
        return [
32 2
            'title'      => ['required' => true, 'type' => 'string'],
33
            'text'       => ['required' => true, 'type' => 'string'],
34
            'picUrl'     => ['required' => false, 'type' => 'string'],
35
            'messageUrl' => ['required' => true, 'type' => 'string'],
36
        ];
37
    }
38
}