Middleware   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 37
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 3 1
A fromArray() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kafkiansky\SymfonyMiddleware\Attribute;
6
7
use Psr\Http\Server\MiddlewareInterface;
8
9
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)]
10
/**
11
 * @psalm-immutable
12
 */
13
final class Middleware
14
{
15
    /**
16
     * @psalm-readonly
17
     *
18
     * @var class-string<MiddlewareInterface>[]|string[]
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<MiddlewareInterface>[]|string[] at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<MiddlewareInterface>[]|string[].
Loading history...
19
     */
20
    public array $list;
21
22
    /**
23
     * @param class-string<MiddlewareInterface>[]|string[] $list
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<MiddlewareInterface>[]|string[] at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<MiddlewareInterface>[]|string[].
Loading history...
24
     */
25
    public function __construct(array $list)
26
    {
27
        $this->list = $list;
28
    }
29
30
    /**
31
     * @return class-string<MiddlewareInterface>[]|string[]
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<MiddlewareInterface>[]|string[] at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<MiddlewareInterface>[]|string[].
Loading history...
32
     */
33
    public function toArray(): array
34
    {
35
        return $this->list;
36
    }
37
38
    /**
39
     * @param class-string<MiddlewareInterface>[]|string[] $list
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<MiddlewareInterface>[]|string[] at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<MiddlewareInterface>[]|string[].
Loading history...
40
     *
41
     * @return Middleware
42
     */
43
    public static function fromArray(array $list): Middleware
44
    {
45
        return new Middleware($list);
46
    }
47
}
48