Passed
Pull Request — 1.x (#321)
by Akihito
02:24
created

Input   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace BEAR\Resource\Annotation;
6
7
use Attribute;
8
9
/**
10
 * Input parameter entity attribute
11
 *
12
 * This attribute marks parameters that should be automatically
13
 * constructed from HTTP input parameters as domain objects.
14
 */
15
#[Attribute(Attribute::TARGET_PARAMETER)]
16
final class Input
17
{
18
    public function __construct(
19
        /**
20
         * Key for structured data (like ClassParam behavior)
21
         *
22
         * When specified, looks for data under this key:
23
         * #[Input(key: 'user')] -> expects $query['user'] = ['name' => 'John', 'age' => 30]
24
         *
25
         * When null, uses flat parameter mapping:
26
         * #[Input] -> expects $query = ['firstName' => 'John', 'lastName' => 'Doe']
27
         */
28
        public readonly string|null $key = null,
29
    ) {
30
    }
31
}
32