BaseSpool   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A flush() 0 4 1
1
<?php
2
/**
3
 * @link https://github.com/Izumi-kun/yii2-spoolmailer
4
 * @copyright Copyright (c) 2017 Viktor Khokhryakov
5
 * @license http://opensource.org/licenses/BSD-3-Clause
6
 */
7
8
namespace izumi\spoolmailer\spools;
9
10
use izumi\spoolmailer\MailerTransport;
11
use Swift_SpoolTransport;
12
use yii\mail\BaseMailer;
13
use yii\swiftmailer\Mailer;
14
15
/**
16
 * BaseSpool.
17
 *
18
 * @method Swift_SpoolTransport getTransport()
19
 * @property Swift_SpoolTransport $transport
20
 * @author Viktor Khokhryakov <[email protected]>
21
 */
22
abstract class BaseSpool extends Mailer
23
{
24
    /**
25
     * Sends messages using the given mailer instance.
26
     * @param BaseMailer $mailer a mailer instance.
27
     * @param string[] $failedRecipients an array of failures by-reference.
28
     * @return int the number of sent emails.
29
     */
30 4
    public function flush(BaseMailer $mailer, &$failedRecipients = null)
31
    {
32 4
        $transport = new MailerTransport($mailer);
33 4
        return $this->getTransport()->getSpool()->flushQueue($transport, $failedRecipients);
34
    }
35
}
36