GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 38a62f...ed2944 )
by Alex
03:31
created

MailerPipe::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Conversio\Mail\Pipeline\Pipe;
4
5
use Conversio\Mail\Mail;
6
use Conversio\Mail\Mailer\MailerInterface;
7
use Conversio\Mail\Pipeline\MailPipeInterface;
8
use Conversio\Mail\Pipeline\ProcessResult;
9
10
/**
11
 * Class MailerPipe
12
 * @package Conversio\Mail\Pipeline\Pipe
13
 */
14
final class MailerPipe implements MailPipeInterface
15
{
16
    /**
17
     * @var MailerInterface
18
     */
19
    private $mailer;
20
21
    /**
22
     * MailerPipe constructor.
23
     *
24
     * @param MailerInterface $mailer
25
     */
26 1
    public function __construct(MailerInterface $mailer)
27
    {
28 1
        $this->mailer = $mailer;
29 1
    }
30
31
    /**
32
     * @param Mail          $mail
33
     * @param ProcessResult $result
34
     *
35
     * @return ProcessResult
36
     */
37 1
    public function process(Mail $mail, ProcessResult $result): ProcessResult
38
    {
39 1
        if ($result->errored()) {
40 1
            return $result;
41
        }
42
43 1
        if ($this->mailer->send($mail)) {
44 1
            $result->setStatus(ProcessResult::SUCCEEDED);
45
        } else {
46 1
            $result->setStatus(ProcessResult::FAILED);
47 1
            $result->addInfo(self::class, $this->mailer->getErrorInfo());
48
        }
49
50 1
        return $result;
51
    }
52
}