AzineNotifierServiceMock   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
c 1
b 0
f 1
dl 0
loc 32
ccs 13
cts 13
cp 1
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A sendNotifications() 0 9 2
A sendNewsletter() 0 9 2
A __construct() 0 3 1
1
<?php
2
3
namespace Azine\EmailBundle\Tests\Command;
4
5
use Azine\EmailBundle\Services\AzineNotifierService;
6
7
/**
8
 * This Service compiles and renders the emails to be sent.
9
 *
10
 * @author Dominik Businger
11
 */
12
class AzineNotifierServiceMock extends AzineNotifierService
13
{
14
    private $fail = false;
15
16
    const FAILED_ADDRESS = '[email protected]';
17
    const EMAIL_COUNT = 10;
18
19 6
    public function __construct($fail = false)
20
    {
21 6
        $this->fail = $fail;
22 6
    }
23
24 2
    public function sendNotifications(array &$failedAddresses)
25
    {
26 2
        if ($this->fail) {
27 1
            $failedAddresses[] = self::FAILED_ADDRESS;
28
29 1
            return self::EMAIL_COUNT - 1;
30
        }
31
32 1
        return self::EMAIL_COUNT;
33
    }
34
35 2
    public function sendNewsletter(array &$failedAddresses)
36
    {
37 2
        if ($this->fail) {
38 1
            $failedAddresses[] = self::FAILED_ADDRESS;
39
40 1
            return self::EMAIL_COUNT - 1;
41
        }
42
43 1
        return self::EMAIL_COUNT;
44
    }
45
}
46