RequestMethodMapping   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 6
Bugs 0 Features 0
Metric Value
wmc 1
eloc 14
c 6
b 0
f 0
dl 0
loc 29
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A isValidMethod() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the SF Forward Bundle.
5
 *
6
 * (c) DAOUDI Soufian <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace SfForward\Util;
13
14
class RequestMethodMapping
15
{
16
    const REQUEST_METHOD_GET = 'get';
17
    const REQUEST_METHOD_POST = 'post';
18
19
    const REQUEST_QUERY_GET = 'query';
20
    const REQUEST_QUERY_POST = 'request';
21
22
    const CONTENT_TYPE_GET = 'query';
23
    const CONTENT_TYPE_POST = 'form_params';
24
25
    public static $methodsMapping = [
26
        self::REQUEST_METHOD_GET => self::REQUEST_QUERY_GET,
27
        self::REQUEST_METHOD_POST => self::REQUEST_QUERY_POST,
28
    ];
29
30
    public static $contentTypes = [
31
        self::REQUEST_METHOD_GET => self::CONTENT_TYPE_GET,
32
        self::REQUEST_METHOD_POST => self::CONTENT_TYPE_POST,
33
    ];
34
35
    /**
36
     * @param string $method
37
     *
38
     * @return bool
39
     */
40
    public static function isValidMethod($method)
41
    {
42
        return isset(self::$methodsMapping[$method]);
43
    }
44
}
45