RequestMethodMapping::isValidMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 1
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 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