Test Failed
Push — 5.0 ( aa12f8...5bd2c0 )
by David
40s
created

SwiftTwigMailTemplate::renderMail()   F

Complexity

Conditions 18
Paths 9222

Size

Total Lines 76

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 39
CRAP Score 18

Importance

Changes 0
Metric Value
dl 0
loc 76
ccs 39
cts 39
cp 1
rs 0.7
c 0
b 0
f 0
cc 18
nc 9222
nop 1
crap 18

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace TheCodingMachine\Mail\Template;
4
5
class SwiftTwigMailTemplate extends AbstractSwiftTwigMailTemplate
6
{
7
    /**
8
     * @var string
9
     */
10
    private $twigPath;
11
12
    /**
13
     * SwiftTwigMailTemplate constructor.
14
     * @param \Twig_Environment $twig_Environment
15
     * @param string $twigPath
16
     */
17
    public function __construct(\Twig_Environment $twig_Environment, string $twigPath)
18
    {
19
        parent::__construct($twig_Environment);
20
        $this->twigPath = $twigPath;
21
    }
22
23
    /**
24
     * @return \Twig_Template|\Twig_TemplateInterface
25
     */
26
    public function getTemplate()
27
    {
28
        return $this->twigEnvironment->loadTemplate($this->twigPath);
29
    }
30
}