Completed
Push — feature/institutions-with-pers... ( 5416f5...0b4a72 )
by A.
04:29
created

hasPersonalRaDetailsAction()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
/**
4
 * Copyright 2016 SURFnet B.V.
5
 *
6
 * Licensed under the Apache License, Version 2.0 (the "License");
7
 * you may not use this file except in compliance with the License.
8
 * You may obtain a copy of the License at
9
 *
10
 *     http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing, software
13
 * distributed under the License is distributed on an "AS IS" BASIS,
14
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
 * See the License for the specific language governing permissions and
16
 * limitations under the License.
17
 */
18
19
namespace Surfnet\StepupMiddleware\ApiBundle\Controller;
20
21
use Surfnet\Stepup\Configuration\Value\Institution;
22
use Surfnet\StepupMiddleware\ApiBundle\Configuration\Service\InstitutionWithPersonalRaDetailsService;
23
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
24
use Symfony\Component\HttpFoundation\JsonResponse;
25
use Symfony\Component\HttpFoundation\Request;
26
27
final class InstitutionWithPersonalRaDetailsController extends Controller
28
{
29
    public function hasPersonalRaDetailsAction(Request $request, Institution $institution)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

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

Loading history...
30
    {
31
        $this->denyAccessUnlessGranted(['ROLE_RA', 'ROLE_SS']);
32
33
        $personalRaDetailsEnabled = $this->getService()->institutionHasPersonalRaDetails($institution);
34
35
        return new JsonResponse($personalRaDetailsEnabled);
36
    }
37
38
    /**
39
     * @return InstitutionWithPersonalRaDetailsService
40
     */
41
    private function getService()
42
    {
43
        return $this->container->get('surfnet_stepup_middleware_api.service.institution_with_personal_ra_details');
44
    }
45
}
46