RouteToRoleConverter::generateRoleForRoute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * User: Simon Libaud
4
 * Date: 19/03/2017
5
 * Email: [email protected].
6
 */
7
namespace Sil\RouteSecurityBundle\Role;
8
9
use Sil\RouteSecurityBundle\Interfaces\NamingStrategyInterface;
10
11
/**
12
 * Class RolesGenerator.
13
 *
14
 * This class convert a route name into role name.
15
 * You can replace this converter with your own.
16
 * Make service that implement NamingStrategyInterface and
17
 * configure 'naming_strategy' option with your service id.
18
 */
19
class RouteToRoleConverter implements NamingStrategyInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24 3
    public function generateRoleForRoute($route)
25
    {
26 3
        return 'ROLE_'.strtoupper($route);
27
    }
28
}
29