- md5
- 35a200571a4bd51c8c37dca13408e041
- sha1
- 2db43dca49027d6cab73c3d03adbcf95111b307f
- sha256
- 4428236af1dfd575a1763656aef4c4dcb7e87d226edd3675ccdf29746f8e9cc2
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
<?php
/**
* @package Joomla.Installation
* @subpackage Service
*
* @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Installation\Service\Provider;
use Joomla\CMS\Error\Renderer\JsonRenderer;
use Joomla\CMS\Factory;
use Joomla\CMS\Installation\Application\InstallationApplication;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Psr\Log\LoggerInterface;
/**
* Application service provider
*
* @since 4.0.0
*/
class Application 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->share(
InstallationApplication::class,
function (Container $container) {
$app = new InstallationApplication(null, $container->get('config'), null, $container);
// The session service provider needs Factory::$application, set it if still null
if (Factory::$application === null) {
Factory::$application = $app;
}
$app->setDispatcher($container->get('Joomla\Event\DispatcherInterface'));
$app->setLogger($container->get(LoggerInterface::class));
$app->setSession($container->get('Joomla\Session\SessionInterface'));
return $app;
},
true
);
// Inject a custom JSON error renderer
$container->share(
JsonRenderer::class,
function (Container $container) {
return new \Joomla\CMS\Installation\Error\Renderer\JsonRenderer();
}
);
}
}
The same content is in 5 releases, Joomla 4.2.0-beta3 to 4.2.1-rc2. See them all, or every version of this file.