Passed
Push — master ( ef92e5...c25b22 )
by Pol
04:05
created

ProxyCallback   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 15
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace EcPhp\CasBundle\Controller;
6
7
use EcPhp\CasLib\CasInterface;
8
use Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface;
9
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
10
use Symfony\Component\HttpFoundation\Response;
11
12
/**
13
 * Class ProxyCallback.
14
 */
15
final class ProxyCallback extends AbstractController
16
{
17
    /**
18
     * @param \EcPhp\CasLib\CasInterface $casProtocol
19
     * @param \Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface $httpFoundationFactory
20
     *
21
     * @return \Symfony\Component\HttpFoundation\Response
22
     */
23 1
    public function __invoke(CasInterface $casProtocol, HttpFoundationFactoryInterface $httpFoundationFactory)
24
    {
25 1
        if (null !== $response = $casProtocol->handleProxyCallback()) {
26 1
            return $httpFoundationFactory->createResponse($response);
27
        }
28
29
        return new Response('', Response::HTTP_INTERNAL_SERVER_ERROR);
30
    }
31
}
32