Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
7 / 7
CRAP
100.00% covered (success)
100.00%
13 / 13
Request
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
7 / 7
8
100.00% covered (success)
100.00%
13 / 13
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
5 / 5
 getServerInfo
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getQuery
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getPost
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getFiles
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getRequestUriPath
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getRequestMethod
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
<?php
namespace Luxian\Http;
class Request
{
    protected $server;
    protected $get;
    protected $post;
    protected $files;
    public function __construct(
        array $server,
        array $get = [],
        array $post = [],
        array $files = []
    )
    {
        $this->server = $server;
        $this->get = $get;
        $this->post = $post;
        $this->files = $files;
    }
    public function getServerInfo()
    {
        return $this->server;
    }
    public function getQuery()
    {
        return $this->get;
    }
    public function getPost()
    {
        return $this->post;
    }
    public function getFiles()
    {
        return $this->files;
    }
    public function getRequestUriPath()
    {
        return $this->server['REQUEST_URI'] ?? '/';
    }
    public function getRequestMethod()
    {
        if (isset($this->server['REQUEST_METHOD'])) {
            return strtoupper($this->server['REQUEST_METHOD']);
        }
        return 'GET';
    }
}