FeedCard   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A send() 0 3 1
A __construct() 0 4 1
A addLinks() 0 7 1
A setMessage() 0 6 1
1
<?php
2
3
namespace DingNotice\Messages;
4
5
use DingNotice\DingTalkService;
6
7
class FeedCard extends Message
8
{
9
    protected $service;
10
11
    public function __construct(DingTalkService $service)
12
    {
13
        $this->service = $service;
14
        $this->setMessage();
15
16
    }
17
18
    public function setMessage(){
19
        $this->message = [
20
            'feedCard' => [
21
                'links' => []
22
            ],
23
            'msgtype' => 'feedCard'
24
        ];
25
    }
26
27
    public function addLinks($title,$messageUrl,$picUrl){
28
        $this->message['feedCard']['links'][] = [
29
            'title' => $title,
30
            'messageURL' => $messageUrl,
31
            'picURL' => $picUrl
32
        ];
33
        return $this;
34
    }
35
36
    public function send(){
37
        $this->service->setMessage($this);
38
        return $this->service->send();
39
    }
40
41
}