Passed
Push — master ( 575ffc...676c0f )
by Korotkov
03:21 queued 12s
created

Request::instantiate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
c 0
b 0
f 0
nc 2
nop 3
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author    : Jagepard <[email protected]">
7
 * @license   https://mit-license.org/ MIT
8
 */
9
10
namespace Rudra\Container;
11
12
use Rudra\Container\{Interfaces\ContainerInterface, Interfaces\RequestInterface, Traits\InstantiationsTrait};
13
14
class Request implements RequestInterface
15
{
16
    use InstantiationsTrait;
17
18
    public function get(): ContainerInterface
19
    {
20
        return $this->instantiate("get", Container::class, $_GET);
21
    }
22
23
    public function post(): ContainerInterface
24
    {
25
        return $this->instantiate("post", Container::class, $_POST);
26
    }
27
28
    public function put(): ContainerInterface
29
    {
30
        return $this->instantiate("put", Container::class);
31
    }
32
33
    public function patch(): ContainerInterface
34
    {
35
        return $this->instantiate("patch", Container::class);
36
    }
37
38
    public function delete(): ContainerInterface
39
    {
40
        return $this->instantiate("delete", Container::class);
41
    }
42
43
    public function server(): ContainerInterface
44
    {
45
        return $this->instantiate("server", Container::class, $_SERVER);
46
    }
47
48
    public function files(): Files
49
    {
50
        return $this->instantiate("files", Files::class, $_FILES);
51
    }
52
}
53