GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PostcodeController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fetchAction() 0 13 2
1
<?php
2
/*
3
* (c) Wessel Strengholt <[email protected]>
4
*
5
* For the full copyright and license information, please view the LICENSE
6
* file that was distributed with this source code.
7
*/
8
9
namespace Usoft\PostcodeBundle\Controller;
10
11
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
12
use Symfony\Component\HttpFoundation\JsonResponse;
13
use Symfony\Component\HttpFoundation\Request;
14
use Symfony\Component\HttpFoundation\Response;
15
16
/**
17
 * Class PostcodeController
18
 *
19
 * @author Wessel Strengholt <[email protected]>
20
 */
21
class PostcodeController extends Controller
22
{
23
    /**
24
     * @param Request $request
25
     *
26
     * @return JsonResponse
27
     */
28
    public function fetchAction(Request $request)
29
    {
30
        try {
31
            $postcode    = $request->get('postcode');
32
            $houseNumber = $request->get('nummer');
33
34
            $address = $this->get('usoft.postcode.client')->getAddress($postcode, $houseNumber);
35
36
            return new JsonResponse($address->toArray());
37
        } catch (\Exception $exception) {
38
            return new JsonResponse(['message' => $exception->getMessage()], Response::HTTP_SERVICE_UNAVAILABLE);
39
        }
40
    }
41
}
42