Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| tables | |
100.00% |
9 / 9 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
1 / 1 |
| load | |
100.00% |
8 / 8 |
|
100.00% |
1 / 1 |
3 | |||
| getAlias | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | namespace phpbb\di\extension; |
| 15 | |
| 16 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 17 | use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
| 18 | |
| 19 | /** |
| 20 | * Container tables extension |
| 21 | */ |
| 22 | class tables extends Extension |
| 23 | { |
| 24 | /** |
| 25 | * {@inheritDoc} |
| 26 | */ |
| 27 | public function load(array $configs, ContainerBuilder $container) |
| 28 | { |
| 29 | // Tables is a reserved parameter and will be overwritten at all times |
| 30 | $tables = []; |
| 31 | |
| 32 | // Add access via 'tables' parameter to acquire array with all tables |
| 33 | $parameterBag = $container->getParameterBag(); |
| 34 | $parameters = $parameterBag->all(); |
| 35 | foreach ($parameters as $parameter_name => $parameter_value) |
| 36 | { |
| 37 | if (!preg_match('/tables\.(.+)/', $parameter_name, $matches)) |
| 38 | { |
| 39 | continue; |
| 40 | } |
| 41 | |
| 42 | $tables[$matches[1]] = $parameter_value; |
| 43 | } |
| 44 | |
| 45 | $container->setParameter('tables', $tables); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Returns the recommended alias to use in XML. |
| 50 | * |
| 51 | * This alias is also the mandatory prefix to use when using YAML. |
| 52 | * |
| 53 | * @return string The alias |
| 54 | */ |
| 55 | public function getAlias(): string |
| 56 | { |
| 57 | return 'tables'; |
| 58 | } |
| 59 | } |