Passed
Push — master ( fcabc1...64f2a1 )
by Simon
02:24
created

RouteToRoleConverter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
dl 0
loc 8
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A generateRoleForRoute() 0 3 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
    public function generateRoleForRoute($route)
25
    {
26
        return 'ROLE_'.strtoupper($route);
27
    }
28
}
29