Body   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 9 2
1
<?php
2
3
namespace Jasny\Controller\Parameter;
4
5
use Psr\Http\Message\ServerRequestInterface;
6
7
#[\Attribute]
8
class Body implements Parameter
9
{
10
    /**
11
     * Get body or body parameters.
12
     */
13
    public function getValue(
14
        ServerRequestInterface $request,
15
        string $name,
16
        ?string $type,
17
        bool $required = false
18
    ): mixed {
19
        return $type === 'string'
20
            ? (string)$request->getBody()
21
            : $request->getParsedBody();
22
    }
23
}
24