Completed
Push — master ( c432ac...8e117f )
by Mathijs
04:01
created

Method   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 25
Duplicated Lines 48 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 1
dl 12
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B validate() 12 12 5

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 mcorten87\rabbitmq_api\objects;
4
5
class Method extends BaseObject
6
{
7
    const METHOD_GET = 'GET';
8
    const METHOD_POST = 'POST';
9
    const METHOD_PUT = 'PUT';
10
    const METHOD_DELETE = 'DELETE';
11
12
    public function __construct(string $value)
13
    {
14
        parent::__construct($value);
15
    }
16
17 View Code Duplication
    protected function validate($value) : bool
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...
18
    {
19
        switch ($value) {
20
            case self::METHOD_GET:
21
            case self::METHOD_POST:
22
            case self::METHOD_PUT:
23
            case self::METHOD_DELETE:
24
                return true;
25
            default:
26
                return false;
27
        }
28
    }
29
}
30