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

ProxyCallback::__invoke()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 7
ccs 3
cts 4
cp 0.75
crap 2.0625
rs 10
c 0
b 0
f 0
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