CoreFiles by mySites.guru
Config.php57 lines, 1,522 bytes, from Joomla_5.2.4-Stable-Full_Package.zip
Raw History Compare with 5.2.3
md5
7ebc65ad66437762021df06815da6fa4
sha1
4562a4206ee31f88e69904613d08ff6de1b2f06a
sha256
24c86896ff5d4ad8ac8e662a40f0da81c27d8a0e741b01ccffc0ff7b5a3294ac
<?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;

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

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Service provider for the application's config dependency
 *
 * @since  4.0.0
 */
class Config implements ServiceProviderInterface
{
    /**
     * Registers the service provider with a DI container.
     *
     * @param   Container  $container  The DI container.
     *
     * @return  void
     *
     * @since   4.0.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 155 releases, Joomla 5.0.0-alpha1 to 6.2.1-rc1. See them all, or every version of this file.