MailService   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 35
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A send() 0 12 2
A setAdapter() 0 4 1
A setLogger() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Linio\Component\Mail;
6
7
use Psr\Log\LoggerInterface;
8
9
class MailService
10
{
11
    /**
12
     * @var AdapterInterface
13
     */
14
    protected $adapter;
15
16
    /**
17
     * @var LoggerInterface
18
     */
19
    protected $logger;
20
21
    public function send(Message $message): bool
0 ignored issues
show
Coding Style introduced by
function send() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
22
    {
23
        try {
24
            $this->adapter->send($message);
25
        } catch (\Exception $e) {
26
            $this->logger->error('[Mail] An error has occurred: ' . $e->getMessage(), (array) $e);
27
28
            return false;
29
        }
30
31
        return true;
32
    }
33
34
    public function setAdapter(AdapterInterface $adapter): void
35
    {
36
        $this->adapter = $adapter;
37
    }
38
39
    public function setLogger(LoggerInterface $logger): void
40
    {
41
        $this->logger = $logger;
42
    }
43
}
44