MethodsEnum   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 21
c 1
b 0
f 0
dl 0
loc 27
ccs 0
cts 2
cp 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A isValid() 0 3 1
1
<?php
2
/**
3
 * This file is part of Phiremock.
4
 *
5
 * Phiremock is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU Lesser General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * Phiremock is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with Phiremock.  If not, see <http://www.gnu.org/licenses/>.
17
 */
18
19
namespace Mcustiel\Phiremock\Domain\Http;
20
21
class MethodsEnum
22
{
23
    const GET = 'GET';
24
    const POST = 'POST';
25
    const PUT = 'PUT';
26
    const DELETE = 'DELETE';
27
    const FETCH = 'FETCH';
28
    const HEAD = 'HEAD';
29
    const OPTIONS = 'OPTIONS';
30
    const PATCH = 'PATCH';
31
    const LINK = 'LINK';
32
33
    private const VALID_METHODS = [
34
        self::GET,
35
        self::POST,
36
        self::PUT,
37
        self::DELETE,
38
        self::PATCH,
39
        self::FETCH,
40
        self::OPTIONS,
41
        self::HEAD,
42
        self::LINK,
43
    ];
44
45
    public static function isValid(string $method): bool
46
    {
47
        return \in_array(strtoupper($method), self::VALID_METHODS, true);
48
    }
49
}
50