Completed
Push — master ( fb9892...6dff17 )
by David
02:46
created

ProviderResponse   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 41
loc 41
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 3 3 1
A create() 8 8 1
A getProviders() 4 4 1
A getTag() 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
/*
4
 * Copyright (C) 2013 Mailgun
5
 *
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Mailgun\Model\Tag;
11
12
use Mailgun\Model\ApiResponse;
13
14
/**
15
 * @author Tobias Nyholm <[email protected]>
16
 */
17 View Code Duplication
final class ProviderResponse implements ApiResponse
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...
18
{
19
    /**
20
     * @var array [name => data[]]
21
     */
22
    private $providers;
23
24
    /**
25
     * @var string
26
     */
27
    private $tag;
28
29
    /**
30
     * @param string $message
0 ignored issues
show
Bug introduced by
There is no parameter named $message. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
31
     */
32 1
    private function __construct()
33
    {
34 1
    }
35
36
    /**
37
     * @param array $data
38
     */
39 1
    public static function create(array $data): self
40
    {
41 1
        $model = new self();
42 1
        $model->tag = $data['tag'] ?? '';
43 1
        $model->providers = $data['providers'] ?? [];
44
45 1
        return $model;
46
    }
47
48 1
    public function getProviders(): array
49
    {
50 1
        return $this->providers;
51
    }
52
53 1
    public function getTag(): string
54
    {
55 1
        return $this->tag;
56
    }
57
}
58