ApiController   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 23
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAllAction() 0 6 1
1
<?php
2
3
namespace Overwatch\ExpectationBundle\Controller;
4
5
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
6
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
7
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
8
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
9
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
10
use Symfony\Component\HttpFoundation\JsonResponse;
11
12
/**
13
 * ApiController
14
 * Handles API requests made for expectations
15
 *
16
 * @Route("/api/expectations")
17
 */
18
class ApiController extends Controller
19
{
20
    /**
21
     * Returns a list of all the expectations that are installed and available to use in tests
22
     *
23
     * @Route("")
24
     * @Method({"GET"})
25
     * @Security("has_role('ROLE_ADMIN')")
26
     * @ApiDoc(
27
     *     resource=true,
28
     *     tags={
29
     *         "Super Admin" = "#ff1919",
30
     *         "Admin" = "#ffff33"
31
     *     }
32
     * )
33
     */
34 1
    public function getAllAction()
35
    {
36 1
        return new JsonResponse(
37 1
            $this->get('overwatch_expectation.expectation_manager')->getAll()
38 1
        );
39
    }
40
}
41