AzineNotifierServiceMock::sendNewsletter()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

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