| Conditions | 2 |
| Paths | 2 |
| Total Lines | 24 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function generate($actionName, $adminName, AdminConfiguration $configuration) |
||
| 11 | { |
||
| 12 | if (!array_key_exists($actionName, $configuration->getParameter('actions'))) { |
||
| 13 | throw new Exception( |
||
| 14 | sprintf('Invalid action name %s for admin %s (available action are: %s)', |
||
| 15 | $actionName, |
||
| 16 | $adminName, |
||
| 17 | implode(', ', array_keys($configuration->getParameter('actions')))) |
||
| 18 | ); |
||
| 19 | } |
||
| 20 | // generate the route name using the configured pattern |
||
| 21 | $routeName = str_replace( |
||
| 22 | '{admin}', |
||
| 23 | strtolower($adminName), |
||
| 24 | $configuration->getParameter('routing_name_pattern') |
||
| 25 | ); |
||
| 26 | $routeName = str_replace( |
||
| 27 | '{action}', |
||
| 28 | $actionName, |
||
| 29 | $routeName |
||
| 30 | ); |
||
| 31 | |||
| 32 | return $routeName; |
||
| 33 | } |
||
| 34 | } |
||
| 35 |