Failed Conditions
Push — master ( a26426...65249a )
by Arnold
14:53 queued 04:44
created

Body   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
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 11
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getValue() 0 5 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace Jasny\Controller\Parameter;
4
5
use Psr\Http\Message\ServerRequestInterface;
6
7
#[\Attribute]
8
class Body implements Parameter
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class Body
Loading history...
9
{
10
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $request should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $name should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $type should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $required should have a doc-comment as per coding-style.
Loading history...
11
     * Get body or body parameters.
12
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
13
    public function getValue(ServerRequestInterface $request, string $name, ?string $type, bool $required = false): mixed
14
    {
15
        return $type === 'string'
16
            ? (string)$request->getBody()
17
            : $request->getParsedBody();
18
    }
19
}
20