kafkiansky /
symfony-middleware
| 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
Loading history...
|
|||
| 19 | */ |
||
| 20 | public array $list; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param class-string<MiddlewareInterface>[]|string[] $list |
||
|
0 ignored issues
–
show
|
|||
| 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
|
|||
| 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
|
|||
| 40 | * |
||
| 41 | * @return Middleware |
||
| 42 | */ |
||
| 43 | public static function fromArray(array $list): Middleware |
||
| 44 | { |
||
| 45 | return new Middleware($list); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |