Passed
Push — master ( ac4415...6c0960 )
by Zing
04:55
created

LogGateway   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A send() 0 6 1
1
<?php
2
3
namespace Zing\LaravelSms\Gateways;
4
5
use Illuminate\Support\Facades\Log;
6
use Overtrue\EasySms\Contracts\MessageInterface;
7
use Overtrue\EasySms\Contracts\PhoneNumberInterface;
8
use Overtrue\EasySms\Gateways\Gateway;
9
use Overtrue\EasySms\Support\Config;
10
11
class LogGateway extends Gateway
12
{
13 16
    public function send(PhoneNumberInterface $number, MessageInterface $message, Config $config)
14
    {
15 16
        $channel = $this->config->get('channel');
16 16
        $level = $this->config->get('level', 'info');
17
18 16
        Log::channel($channel)->{$level}(sprintf('number: %s, message: "%s", template: "%s", data: %s, type: %s', $number, $message->getContent($this), $message->getTemplate($this), json_encode($message->getData($this)), $message->getMessageType()));
19 16
    }
20
}
21