Completed
Pull Request — master (#290)
by
unknown
36:49 queued 34:03
created

AddProductReviewBySlug   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 72
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 9 9 1
A productSlug() 4 4 1
A channelCode() 4 4 1
A title() 4 4 1
A rating() 4 4 1
A comment() 4 4 1
A email() 4 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
declare(strict_types=1);
4
5
namespace Sylius\SyliusShopApiPlugin\Command;
6
7 View Code Duplication
final class AddProductReviewBySlug
0 ignored issues
show
Duplication introduced by
This class 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...
8
{
9
    /**
10
     * @var string
11
     */
12
    private $productSlug;
13
14
    /**
15
     * @var string
16
     */
17
    private $channelCode;
18
19
    /**
20
     * @var string
21
     */
22
    private $title;
23
24
    /**
25
     * @var int
26
     */
27
    private $rating;
28
29
    /**
30
     * @var string
31
     */
32
    private $comment;
33
34
    /**
35
     * @var string
36
     */
37
    private $email;
38
39
    public function __construct(string $productSlug, string $channelCode, string $title, int $rating, string $comment, string $email)
40
    {
41
        $this->productSlug = $productSlug;
42
        $this->channelCode = $channelCode;
43
        $this->title = $title;
44
        $this->rating = $rating;
45
        $this->comment = $comment;
46
        $this->email = $email;
47
    }
48
49
    public function productSlug(): string
50
    {
51
        return $this->productSlug;
52
    }
53
54
    public function channelCode(): string
55
    {
56
        return $this->channelCode;
57
    }
58
59
    public function title(): string
60
    {
61
        return $this->title;
62
    }
63
64
    public function rating(): int
65
    {
66
        return $this->rating;
67
    }
68
69
    public function comment(): string
70
    {
71
        return $this->comment;
72
    }
73
74
    public function email(): string
75
    {
76
        return $this->email;
77
    }
78
}
79