Completed
Push — master ( fbc01c...6057b3 )
by Westin
15s
created

SwiftMailerHandlerFactory::getMailer()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 8
nc 3
nop 1
crap 3
1
<?php
2
declare(strict_types=1);
3
4
namespace WShafer\PSR11MonoLog\Handler;
5
6
use Monolog\Handler\SwiftMailerHandler;
7
use Monolog\Logger;
8
use WShafer\PSR11MonoLog\ContainerAwareInterface;
9
use WShafer\PSR11MonoLog\FactoryInterface;
10
11 View Code Duplication
class SwiftMailerHandlerFactory implements FactoryInterface, ContainerAwareInterface
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
12
{
13
    use SwiftMessageTrait;
14
15 1
    public function __invoke(array $options)
16
    {
17 1
        $mailer  = $this->getService($options['mailer'] ?? null);
18 1
        $message = $this->getSwiftMessage($options);
19
20 1
        $level   = (int)     ($options['level']  ?? Logger::DEBUG);
21 1
        $bubble  = (boolean) ($options['bubble'] ?? true);
22
23 1
        return new SwiftMailerHandler($mailer, $message, $level, $bubble);
24
    }
25
}
26