Attachment::getFileContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace kalanis\EmailApi\Basics;
4
5
6
use kalanis\EmailApi\Interfaces\IContentAttachment;
7
8
9
/**
10
 * Class Attachment
11
 * @package kalanis\EmaiApi\Basics
12
 */
13
class Attachment implements IContentAttachment
14
{
15
    public string $name = '';
16
    public string $path = '';
17
    public string $content = '';
18
    public string $mime = '';
19
    public string $encoding = '';
20
    public int $type = self::TYPE_INLINE;
21
22 5
    public function setData(string $name, string $path = '', string $content = '', string $mime = '', string $encoding = '', int $type = self::TYPE_INLINE): self
23
    {
24 5
        $this->name = $name;
25 5
        $this->path = $path;
26 5
        $this->mime = $mime;
27 5
        $this->content = $content;
28 5
        $this->encoding = $encoding;
29 5
        $this->type = $type;
30 5
        return $this;
31
    }
32
33 1
    public function sanitize(): self
34
    {
35 1
        $this->name = strval($this->name);
36 1
        $this->path = strval($this->path);
37 1
        $this->mime = strval($this->mime);
38 1
        $this->content = strval($this->content);
39 1
        $this->encoding = strval($this->encoding);
40 1
        $this->type = intval($this->type);
41 1
        return $this;
42
    }
43
44 1
    public function getFileName(): string
45
    {
46 1
        return strval($this->name);
47
    }
48
49 1
    public function getFileContent(): string
50
    {
51 1
        return strval($this->content);
52
    }
53
54 1
    public function getLocalPath(): string
55
    {
56 1
        return strval($this->path);
57
    }
58
59 1
    public function getFileMime(): string
60
    {
61 1
        return strval($this->mime);
62
    }
63
64 1
    public function getEncoding(): string
65
    {
66 1
        return strval($this->encoding);
67
    }
68
69 1
    public function getType(): int
70
    {
71 1
        return intval($this->type);
72
    }
73
}
74