HttpMethod   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isValid() 0 4 1
1
<?php
2
3
namespace Muzzle;
4
5
use MyCLabs\Enum\Enum;
6
7
/**
8
 * @method static HttpMethod CONNECT
9
 * @method static HttpMethod DELETE
10
 * @method static HttpMethod GET
11
 * @method static HttpMethod HEAD
12
 * @method static HttpMethod OPTIONS
13
 * @method static HttpMethod PATCH
14
 * @method static HttpMethod POST
15
 * @method static HttpMethod PUT
16
 * @method static HttpMethod TRACE
17
 */
18
class HttpMethod extends Enum
19
{
20
21
    const CONNECT = 'CONNECT';
22
    const DELETE = 'DELETE';
23
    const GET = 'GET';
24
    const HEAD = 'HEAD';
25
    const OPTIONS = 'OPTIONS';
26
    const PATCH = 'PATCH';
27
    const POST = 'POST';
28
    const PUT = 'PUT';
29
    const TRACE = 'TRACE';
30
31
    public function __construct(string $value)
32
    {
33
34
        parent::__construct(strtoupper($value));
35
    }
36
37
    public static function isValid($value)
38
    {
39
40
        return in_array(strtoupper($value), static::toArray(), true);
41
    }
42
}
43