- md5
- 4f3d16e67f9b5916465c0dda7810925b
- sha1
- ad3f76a5d91c0db8750fa409c35e6cf6a6ee86d3
- sha256
- 8dcef29dc5d3abc8fb8d58171d33d61f9d6be0a2d21c5c44bc5a4e67f8d9d11e
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
<?php
/**
* @package Joomla.Libraries
* @subpackage Service
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\CMS\Service\Provider;
defined('JPATH_PLATFORM') or die;
use Joomla\Console\Application as BaseConsoleApplication;
use Joomla\CMS\Application\AdministratorApplication;
use Joomla\CMS\Application\ConsoleApplication;
use Joomla\CMS\Application\SiteApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\Log\Log;
use Joomla\CMS\Session\Session;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Session\Storage\RuntimeStorage;
/**
* Application service provider
*
* @since 4.0
*/
class Application 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(AdministratorApplication::class, 'JApplicationAdministrator')
->share(
'JApplicationAdministrator',
function (Container $container)
{
$app = new AdministratorApplication(null, null, 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(Log::createDelegatedLogger());
$app->setSession($container->get('Joomla\Session\SessionInterface'));
return $app;
},
true
);
$container->alias(SiteApplication::class, 'JApplicationSite')
->share(
'JApplicationSite',
function (Container $container)
{
$app = new SiteApplication(null, null, 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(Log::createDelegatedLogger());
$app->setSession($container->get('Joomla\Session\SessionInterface'));
return $app;
},
true
);
$container->alias(ConsoleApplication::class, BaseConsoleApplication::class)
->share(
BaseConsoleApplication::class,
function (Container $container)
{
$app = new ConsoleApplication;
$dispatcher = $container->get('Joomla\Event\DispatcherInterface');
$session = new Session(new RuntimeStorage);
$session->setDispatcher($dispatcher);
$app->setContainer($container);
$app->setDispatcher($dispatcher);
$app->setLogger(Log::createDelegatedLogger());
$app->setSession($session);
return $app;
},
true
);
}
}
No other release has this exact content. See every version of this file.