Passed
Push — master ( 7149fc...8a2723 )
by Gabriel
01:48
created

HasAttachmentsTrait::attachFromContent()   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 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
namespace Nip\Mail\Message;
4
5
use Swift_Attachment;
6
7
/**
8
 * Trait HasAttachmentsTrait
9
 * @package Nip\Mail\Message
10
 */
11
trait HasAttachmentsTrait
12
{
13
    /**
14
     * @param $content
15
     * @param $name
16
     */
17 1
    public function attachFromContent($content, $name = null, $contentType = null)
0 ignored issues
show
Unused Code introduced by
The parameter $contentType is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

17
    public function attachFromContent($content, $name = null, /** @scrutinizer ignore-unused */ $contentType = null)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19 1
        $attachment = new Swift_Attachment($content, $name);
20 1
        $this->attach($attachment);
0 ignored issues
show
Bug introduced by
The method attach() does not exist on Nip\Mail\Message\HasAttachmentsTrait. Did you maybe mean attachFromContent()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $this->/** @scrutinizer ignore-call */ 
21
               attach($attachment);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
21
22 1
    }
23
}
24