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
Branch pipeline (ed5cab)
by Alex
04:12
created

MailerPipe   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 39
c 0
b 0
f 0
wmc 4
lcom 1
cbo 2
ccs 11
cts 11
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A process() 0 15 3
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
}