Method::validate()   B
last analyzed

Complexity

Conditions 5
Paths 5

Size

Total Lines 12
Code Lines 9

Duplication

Lines 12
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 5

Importance

Changes 0
Metric Value
dl 12
loc 12
ccs 7
cts 7
cp 1
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 9
nc 5
nop 1
crap 5
1
<?php
2
3
namespace mcorten87\rabbitmq_api\objects;
4
5
class Method extends BaseObject
6
{
7
    const GET = 'GET';
8
    const POST = 'POST';
9
    const PUT = 'PUT';
10
    const DELETE = 'DELETE';
11
12 73
    public function __construct(string $value)
13
    {
14 73
        parent::__construct($value);
15 72
    }
16
17 73 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 73
            case self::GET:
21 32
            case self::POST:
22 29
            case self::PUT:
23 12
            case self::DELETE:
24 72
                return true;
25
            default:
26 1
                return false;
27
        }
28
    }
29
}
30