| Total Complexity | 5 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | final class SessionValueResolver implements ArgumentValueResolverInterface |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * {@inheritdoc} |
||
| 26 | */ |
||
| 27 | 8 | public function supports(ArgumentResolverContextInterface $context, ArgumentMetadata $argument) |
|
| 28 | { |
||
| 29 | 8 | if (!$context->getRequest()->hasSession()) { |
|
| 30 | 4 | return false; |
|
| 31 | } |
||
| 32 | |||
| 33 | 4 | $type = $argument->getType(); |
|
| 34 | 4 | if (SessionInterface::class !== $type && !is_subclass_of($type, SessionInterface::class)) { |
|
| 35 | 1 | return false; |
|
| 36 | } |
||
| 37 | |||
| 38 | 3 | return $context->getRequest()->getSession() instanceof $type; |
|
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * {@inheritdoc} |
||
| 43 | */ |
||
| 44 | 1 | public function resolve(ArgumentResolverContextInterface $context, ArgumentMetadata $argument) |
|
| 47 | } |
||
| 48 | } |
||
| 49 |