[ Index ]

PHP Cross Reference of phpBB-3.1.12-deutsch

title

Body

[close]

/phpbb/di/extension/ -> ext.php (source)

   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  use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
  19  use Symfony\Component\Config\FileLocator;
  20  
  21  /**
  22  * Container ext extension
  23  */
  24  class ext extends Extension
  25  {
  26      protected $paths = array();
  27  
  28  	public function __construct($enabled_extensions)
  29      {
  30          foreach ($enabled_extensions as $ext => $path)
  31          {
  32              $this->paths[] = $path;
  33          }
  34      }
  35  
  36      /**
  37      * Loads a specific configuration.
  38      *
  39      * @param array            $config    An array of configuration values
  40      * @param ContainerBuilder $container A ContainerBuilder instance
  41      *
  42      * @throws \InvalidArgumentException When provided tag is not defined in this extension
  43      */
  44  	public function load(array $config, ContainerBuilder $container)
  45      {
  46          foreach ($this->paths as $path)
  47          {
  48              if (file_exists($path . '/config/services.yml'))
  49              {
  50                  $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($path . '/config')));
  51                  $loader->load('services.yml');
  52              }
  53          }
  54      }
  55  
  56      /**
  57      * Returns the recommended alias to use in XML.
  58      *
  59      * This alias is also the mandatory prefix to use when using YAML.
  60      *
  61      * @return string The alias
  62      */
  63  	public function getAlias()
  64      {
  65          return 'ext';
  66      }
  67  }


Generated: Thu Jan 11 00:25:41 2018 Cross-referenced by PHPXref 0.7.1