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

LogAgent::sendSms()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 8
ccs 6
cts 6
cp 1
rs 9.4286
cc 2
eloc 5
nc 2
nop 4
crap 2
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