Request   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
c 0
b 0
f 0
dl 0
loc 16
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUri() 0 7 2
A getMethod() 0 3 1
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