| Conditions | 6 |
| Paths | 7 |
| Total Lines | 23 |
| Lines | 10 |
| Ratio | 43.48 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | function graphql_twig_theme($existing, $type, $theme, $path) { |
||
| 9 | /** @var \Drupal\Core\Extension\ThemeHandlerInterface $themeHandler */ |
||
| 10 | $themeHandler = \Drupal::service('theme_handler'); |
||
| 11 | $theme = []; |
||
| 12 | foreach ($themeHandler->listInfo() as $themeName => $info) { |
||
| 13 | |||
| 14 | // Register twig routes as theme hooks. |
||
| 15 | View Code Duplication | if (isset($info->info['routes'])) { |
|
| 16 | foreach ($info->info['routes'] as $name => $route) { |
||
| 17 | $theme[$name] = ['variables' => ['graphql_arguments' => []]]; |
||
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 21 | // Register twig blocks as theme hooks. |
||
| 22 | View Code Duplication | if (isset($info->info['blocks'])) { |
|
| 23 | foreach ($info->info['blocks'] as $name => $block) { |
||
| 24 | $theme[$name] = ['variables' => ['graphql_arguments' => []]]; |
||
| 25 | } |
||
| 26 | } |
||
| 27 | |||
| 28 | } |
||
| 29 | return $theme; |
||
| 30 | } |
||
| 31 | |||
| 32 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.