Completed
Pull Request — master (#311)
by
unknown
14:10
created

UploadImage   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 103
Duplicated Lines 14.56 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 0
dl 15
loc 103
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 15 15 1
A getLanguage() 0 4 1
A getFileId() 0 4 1
A getDescription() 0 4 1
A getCopyrightHolder() 0 4 1
A getMimeType() 0 4 1
A getFilePath() 0 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace CultuurNet\UDB3\Media\Commands;
4
5
use CultuurNet\UDB3\Language;
6
use CultuurNet\UDB3\Media\Properties\MIMEType;
7
use ValueObjects\Identity\UUID;
8
use ValueObjects\StringLiteral\StringLiteral;
9
10
class UploadImage
11
{
12
    /**
13
     * @var UUID
14
     */
15
    protected $fileId;
16
17
    /**
18
     * @var Language
19
     */
20
    protected $language;
21
22
    /**
23
     * @var StringLiteral
24
     */
25
    protected $description;
26
27
    /**
28
     * @var StringLiteral
29
     */
30
    protected $copyrightHolder;
31
32
    /**
33
     * @var MIMEType
34
     */
35
    protected $mimeType;
36
37
    /**
38
     * @var StringLiteral
39
     */
40
    protected $filePath;
41
    /**
42
     * @param UUID $fileId
43
     * @param MIMEType $mimeType
44
     * @param StringLiteral $description
45
     * @param StringLiteral $copyrightHolder
46
     * @param StringLiteral $filePath
47
     * @param Language $language
48
     */
49 View Code Duplication
    public function __construct(
0 ignored issues
show
Duplication introduced by
This method 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...
50
        UUID $fileId,
51
        MIMEType $mimeType,
52
        StringLiteral $description,
53
        StringLiteral $copyrightHolder,
54
        StringLiteral $filePath,
55
        Language $language
56
    ) {
57
        $this->fileId = $fileId;
58
        $this->description = $description;
59
        $this->copyrightHolder = $copyrightHolder;
60
        $this->mimeType = $mimeType;
61
        $this->filePath = $filePath;
62
        $this->language = $language;
63
    }
64
65
    /**
66
     * @return Language
67
     */
68
    public function getLanguage()
69
    {
70
        return $this->language;
71
    }
72
73
    /**
74
     * @return UUID
75
     */
76
    public function getFileId()
77
    {
78
        return $this->fileId;
79
    }
80
81
    /**
82
     * @return StringLiteral
83
     */
84
    public function getDescription()
85
    {
86
        return $this->description;
87
    }
88
89
    /**
90
     * @return StringLiteral
91
     */
92
    public function getCopyrightHolder()
93
    {
94
        return $this->copyrightHolder;
95
    }
96
97
    /**
98
     * @return MIMEType
99
     */
100
    public function getMimeType()
101
    {
102
        return $this->mimeType;
103
    }
104
105
    /**
106
     * @return StringLiteral
107
     */
108
    public function getFilePath()
109
    {
110
        return $this->filePath;
111
    }
112
}
113