Completed
Pull Request — master (#6)
by lan tian
02:14
created

LogAgent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 4
Bugs 2 Features 1
Metric Value
wmc 5
c 4
b 2
f 1
lcom 1
cbo 1
dl 0
loc 29
ccs 18
cts 18
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A sendContentSms() 0 5 1
A sendSms() 0 8 2
A sendTemplateSms() 0 5 1
A voiceVerify() 0 5 1
1
<?php
2
3
namespace Toplan\PhpSms;
4
5
class LogAgent extends Agent
6
{
7 21
    public function sendSms($tempId, $to, array $data, $content)
8
    {
9 21
        if ($content) {
10 18
            $this->sendContentSms($to, $content);
11 18
        } else {
12 3
            $this->sendTemplateSms($tempId, $to, $data);
13
        }
14 21
    }
15
16 18
    public function sendContentSms($to, $content)
17
    {
18 18
        $this->result['success'] = true;
19 18
        $this->result['info'] = 'send content sms success';
20 18
    }
21
22 3
    public function sendTemplateSms($tempId, $to, array $data)
23
    {
24 3
        $this->result['success'] = true;
25 3
        $this->result['info'] = 'send template sms success';
26 3
    }
27
28 3
    public function voiceVerify($to, $code)
29
    {
30 3
        $this->result['success'] = true;
31 3
        $this->result['info'] = "send voice verify to $to success [code = $code]";
32 3
    }
33
}
34