ApiController::getAllAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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