Passed
Push — master ( 16cc4b...9db413 )
by Viktor
01:52
created

BaseSpool   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
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
namespace izumi\spoolmailer\spools;
4
5
use izumi\spoolmailer\MailerTransport;
6
use Swift_SpoolTransport;
7
use yii\mail\BaseMailer;
8
use yii\swiftmailer\Mailer;
9
10
/**
11
 * BaseSpool.
12
 *
13
 * @method Swift_SpoolTransport getTransport()
14
 * @property Swift_SpoolTransport $transport
15
 * @author Viktor Khokhryakov <[email protected]>
16
 */
17
abstract class BaseSpool extends Mailer
18
{
19
    /**
20
     * Sends messages using the given mailer instance.
21
     * @param BaseMailer $mailer a mailer instance.
22
     * @param string[] $failedRecipients an array of failures by-reference.
23
     * @return int the number of sent emails.
24
     */
25
    public function flush(BaseMailer $mailer, &$failedRecipients = null)
26
    {
27
        $transport = new MailerTransport($mailer);
28
        return $this->getTransport()->getSpool()->flushQueue($transport, $failedRecipients);
29
    }
30
}
31