Link::bodyFields()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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