Passed
Push — master ( 0ac9a3...3f373d )
by Yohann
02:09
created

Request::getMethod()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace mvc\core\http;
4
5
class Request
6
{
7
8
    public static function getUri(): string
9
    {
10
        $path = $_SERVER['REQUEST_URI'] ?? '/';
11
        $position = strpos($path, '?');
12
13
        if ($position === false) return $path;
14
        return substr($path, 0, $position);
15
    }
16
17
18
    public static function getMethod(): string
19
    {
20
        return strtolower($_SERVER['REQUEST_METHOD']);
21
    }
22
}
23