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

Input::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 12
rs 10
c 0
b 0
f 0
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