Delete::__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 Delete 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'] === "DELETE") {
15 1
            parse_str(file_get_contents('php://input'), $delete);
16 1
            $_POST = [];
17
        }
18
19 32
        $delete = $delete ?? [];
20 32
        $this->registerGlobal($delete);
21 32
    }
22
}
23