CoreFiles by mySites.guru
Config.php57 lines, 1,222 bytes, from Joomla_4.0.0-beta7-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta6
md5
3bd87e536d0b5fef1da77af3ae23ad15
sha1
b7a4477b67d4397b7ada87dd9f9032a2e0d543c2
sha256
373e0b7a7ccd717ac9c65a86c789c39aa681d2bec2821622e6c807c3fe4198d7
<?php
/**
 * Joomla! Content Management System
 *
 * @copyright  (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\CMS\Service\Provider;

\defined('JPATH_PLATFORM') or die;

use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Registry\Registry;

/**
 * Service provider for the application's config dependency
 *
 * @since  4.0
 */
class Config implements ServiceProviderInterface
{
	/**
	 * Registers the service provider with a DI container.
	 *
	 * @param   Container  $container  The DI container.
	 *
	 * @return  void
	 *
	 * @since   4.0
	 */
	public function register(Container $container)
	{
		$container->alias('config', 'JConfig')
			->share(
				'JConfig',
				function (Container $container)
				{
					if (!is_file(JPATH_CONFIGURATION . '/configuration.php'))
					{
						return new Registry;
					}

					\JLoader::register('JConfig', JPATH_CONFIGURATION . '/configuration.php');

					if (!class_exists('JConfig'))
					{
						throw new \RuntimeException('Configuration class does not exist.');
					}

					return new Registry(new \JConfig);
				},
				true
			);
	}
}

The same content is in 2 releases, Joomla 4.0.0-beta6 to 4.0.0-beta7. See them all, or every version of this file.