Completed
Pull Request — master (#220)
by
unknown
01:45 queued 32s
created

NullDriver::__call()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
3
namespace Spatie\Newsletter;
4
5
use Illuminate\Support\Facades\Log;
6
7
class NullDriver implements Newsletter
8
{
9
    /**
10
     * @var bool
11
     */
12
    private $logCalls;
13
14
    public function __construct(bool $logCalls = false)
15
    {
16
        $this->logCalls = $logCalls;
17
    }
18
19
    public function subscribe(string $email, array $mergeFields = [], string $listName = '', array $options = [])
20
    {
21
        $this->log('subscribe', func_get_args());
22
    }
23
24
    public function subscribePending(
25
        string $email,
26
        array $mergeFields = [],
27
        string $listName = '',
28
        array $options = []
29
    ) {
30
        $this->log('subscribePending', func_get_args());
31
    }
32
33
    public function subscribeOrUpdate(
34
        string $email,
35
        array $mergeFields = [],
36
        string $listName = '',
37
        array $options = []
38
    ) {
39
        $this->log('subscribeOrUpdate', func_get_args());
40
    }
41
42
    public function getMembers(string $listName = '', array $parameters = [])
43
    {
44
        $this->log('getMembers', func_get_args());
45
    }
46
47
    public function getMember(string $email, string $listName = '')
48
    {
49
        $this->log('getMember', func_get_args());
50
    }
51
52
    public function getMemberActivity(string $email, string $listName = '')
53
    {
54
        $this->log('getMemberActivity', func_get_args());
55
    }
56
57
    public function isSubscribed(string $email, string $listName = ''): bool
58
    {
59
        $this->log('isSubscribed', func_get_args());
60
        return true;
61
    }
62
63
    public function unsubscribe(string $email, string $listName = '')
64
    {
65
        $this->log('unsubscribe', func_get_args());
66
    }
67
68
    public function updateEmailAddress(string $currentEmailAddress, string $newEmailAddress, string $listName = '')
69
    {
70
        $this->log('updateEmailAddress', func_get_args());
71
    }
72
73
    public function delete(string $email, string $listName = '')
74
    {
75
        $this->log('delete', func_get_args());
76
    }
77
78
    public function getTags(string $email, string $listName = '')
79
    {
80
        $this->log('getTags', func_get_args());
81
    }
82
83
    public function addTags(array $tags, string $email, string $listName = '')
84
    {
85
        $this->log('addTags', func_get_args());
86
    }
87
88
    public function removeTags(array $tags, string $email, string $listName = '')
89
    {
90
        $this->log('removeTags', func_get_args());
91
    }
92
93
    public function createCampaign(
94
        string $fromName,
95
        string $replyTo,
96
        string $subject,
97
        string $html = '',
98
        string $listName = '',
99
        array $options = [],
100
        array $contentOptions = []
101
    ) {
102
        $this->log('createCampaign', func_get_args());
103
    }
104
105
    public function updateContent(string $campaignId, string $html, array $options = [])
106
    {
107
        $this->log('updateContent', func_get_args());
108
    }
109
110
    public function getLastError()
111
    {
112
        $this->log('getLastError', func_get_args());
113
    }
114
115
    public function lastActionSucceeded(): bool
116
    {
117
        $this->log('lastActionSucceeded', func_get_args());
118
    }
119
120
    public function deletePermanently(string $email, string $listName = '')
121
    {
122
        $this->log('deletePermanently', func_get_args());
123
    }
124
125
    public function hasMember(string $email, string $listName = ''): bool
126
    {
127
        $this->log('hasMember', func_get_args());
128
        return true;
129
    }
130
131
    private function log($name, $arguments)
132
    {
133
        if ($this->logCalls) {
134
            Log::debug('Called Spatie Newsletter facade method: '.$name.' with:', $arguments);
135
        }
136
    }
137
}
138