Put::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 2
crap 2
1
<?php
2
declare(strict_types=1);
3
namespace Zewa\HTTP;
4
5
use Zewa\Container;
6
use Zewa\Security;
7
8
final class Put extends SuperGlobal
9
{
10 32
    public function __construct(Container $container, Security $security)
11
    {
12 32
        parent::__construct($container, $security);
13
14 32
        if ($_SERVER['REQUEST_METHOD'] === "PUT") {
15 6
            parse_str(file_get_contents('php://input'), $put);
16 6
            $_POST = [];
17
        }
18
19 32
        $put = $put ?? [];
20 32
        $this->registerGlobal($put);
21 32
    }
22
}
23