Passed
Push — master ( 371c27...e17cde )
by Hao
04:51
created

Link::validate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 5
cts 5
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 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
        return [
32 1
            '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
}