UploadFile   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 79
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setContent() 0 5 1
A getContent() 0 3 1
A getFilename() 0 3 1
A __construct() 0 5 1
A setContentType() 0 5 1
A getContentType() 0 3 1
A setFilename() 0 5 1
1
<?php
2
3
/*
4
 * This file is part of datamolino client.
5
 *
6
 * (c) 2018 cwd.at GmbH <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cwd\Datamolino\Model;
15
16
class UploadFile
17
{
18
    /** @var int|null */
19
    private $id;
0 ignored issues
show
introduced by
The private property $id is not used, and could be removed.
Loading history...
20
21
    /** @var string */
22
    private $filename;
23
24
    /** @var string */
25
    private $content_type;
26
27
    /** @var string */
28
    private $content;
29
30
    public function __construct(string $filename, string $contentType, string $content)
31
    {
32
        $this->setFilename($filename);
33
        $this->setContentType($contentType);
34
        $this->setContent($content);
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function getFilename(): string
41
    {
42
        return $this->filename;
43
    }
44
45
    /**
46
     * @param string $filename
47
     *
48
     * @return UploadFile
49
     */
50
    public function setFilename(string $filename): UploadFile
51
    {
52
        $this->filename = $filename;
53
54
        return $this;
55
    }
56
57
    /**
58
     * @return string
59
     */
60
    public function getContentType(): string
61
    {
62
        return $this->content_type;
63
    }
64
65
    /**
66
     * @param string $content_type
67
     *
68
     * @return UploadFile
69
     */
70
    public function setContentType(string $content_type): UploadFile
71
    {
72
        $this->content_type = $content_type;
73
74
        return $this;
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    public function getContent(): string
81
    {
82
        return $this->content;
83
    }
84
85
    /**
86
     * @param string $content
87
     *
88
     * @return UploadFile
89
     */
90
    public function setContent(string $content): UploadFile
91
    {
92
        $this->content = base64_encode($content);
93
94
        return $this;
95
    }
96
}
97