SuggestUrlController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 6
c 2
b 0
f 0
dl 0
loc 31
ccs 3
cts 6
cp 0.5
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A linkListAction() 0 4 1
A suggestUrlAction() 0 5 1
1
<?php
2
/**
3
 * For licensing information, please see the LICENSE file accompanied with this file.
4
 *
5
 * @author Gerard van Helden <[email protected]>
6
 * @copyright 2012 Gerard van Helden <http://melp.nl>
7
 */
8
9
namespace Zicht\Bundle\UrlBundle\Controller;
10
11
use Symfony\Component\Routing\Annotation\Route;
12
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
13
use Symfony\Component\HttpFoundation\JsonResponse;
14
use Symfony\Component\HttpFoundation\Request;
15
use Symfony\Component\HttpFoundation\Response;
16
17
/**
18
 * Mounted on the admin path for security.
19
 *
20
 * @Route("/admin")
21
 */
22
class SuggestUrlController extends Controller
23
{
24
    /**
25
     * Controller used for url suggestions by the url provider.
26
     *
27
     * @param Request $request
28
     * @return \Symfony\Component\HttpFoundation\Response
29
     *
30
     * @Route("/url/suggest")
31
     */
32 1
    public function suggestUrlAction(Request $request)
33
    {
34 1
        return new JsonResponse(
35
            array(
36 1
                'suggestions' => $this->get('zicht_url.provider')->suggest($request->get('pattern'))
37
            )
38
        );
39
    }
40
41
    /**
42
     * Lists all links available in the url provider.
43
     *
44
     * @param Request $request
45
     * @return Response
46
     *
47
     * @Route("/url/suggest/editor")
48
     */
49
    public function linkListAction(Request $request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

49
    public function linkListAction(/** @scrutinizer ignore-unused */ Request $request)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50
    {
51
        return new JsonResponse(
52
            $this->get('zicht_url.provider')->all($this->get('security.authorization_checker'))
53
        );
54
    }
55
}
56