Completed
Push — master ( 0e12ee...cb89b4 )
by Nate
02:30
created

ResponseType   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 0
dl 50
loc 50
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A getType() 4 4 1
A getName() 4 4 1
A allowMultiple() 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
 * Copyright (c) 2015 Nate Brunette.
4
 * Distributed under the MIT License (http://opensource.org/licenses/MIT)
5
 */
6
7
namespace Tebru\Retrofit\Annotation;
8
9
use Tebru;
10
use Tebru\Dynamo\Annotation\DynamoAnnotation;
11
12
/**
13
 * Class ResponseType
14
 *
15
 * @author Nate Brunette <[email protected]>
16
 *
17
 * @Annotation
18
 */
19 View Code Duplication
class ResponseType implements DynamoAnnotation
1 ignored issue
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...
20
{
21
    const NAME = 'response_type';
22
23
    /**
24
     * @var string
25
     */
26
    private $type;
27
28
    /**
29
     * Constructor
30
     *
31
     * @param array $params
32
     */
33
    public function __construct(array $params)
34
    {
35
        Tebru\assertThat(isset($params['value']), 'An argument was not passed to a "%s" annotation.', get_class($this));
36
37
        $this->type = $params['value'];
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getType()
44
    {
45
        return $this->type;
46
    }
47
48
    /**
49
     * The name of the annotation or class of annotations
50
     *
51
     * @return string
52
     */
53
    public function getName()
54
    {
55
        return self::NAME;
56
    }
57
58
    /**
59
     * Whether or not multiple annotations of this type can
60
     * be added to a method
61
     *
62
     * @return bool
63
     */
64
    public function allowMultiple()
65
    {
66
        return false;
67
    }
68
}
69