Completed
Push — master ( 1cc36f...868741 )
by Joachim
24:06 queued 17:59
created

ApiWrapperController::indexAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
namespace Loevgaard\PakkelabelsBundle\Controller;
4
5
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
7
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
8
use Symfony\Component\HttpFoundation\JsonResponse;
9
use Symfony\Component\HttpFoundation\Request;
10
11
/**
12
 * @Route("/api-wrapper")
13
 */
14
class ApiWrapperController extends Controller
15
{
16
    /**
17
     * @Method("GET")
18
     * @Route("", name="loevgaard_pakkelabels_api_wrapper")
19
     *
20
     * @param Request $request
21
     *
22
     * @return JsonResponse
23
     */
24
    public function indexAction(Request $request)
25
    {
26
        $uri = $request->query->getAlnum('uri');
27
        $params = $request->query->get('params');
28
29
        $client = $this->get('loevgaard_pakkelabels.client');
30
        $res = $client->doRequest('get', $uri, [
31
            'query' => $params
32
        ]);
33
34
        return new JsonResponse($res);
35
    }
36
}
37