|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * @package Joomla.Administrator |
| 4 | + * @subpackage com_finder |
| 5 | + * |
| 6 | + * @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. |
| 7 | + * @license GNU General Public License version 2 or later; see LICENSE.txt |
| 8 | + */ |
| 9 | + |
| 10 | +defined('_JEXEC') or die; |
| 11 | + |
| 12 | +use Joomla\CMS\Dispatcher\DispatcherFactoryInterface; |
| 13 | +use Joomla\CMS\Extension\ComponentInterface; |
| 14 | +use Joomla\CMS\Extension\MVCComponent; |
| 15 | +use Joomla\CMS\Extension\Service\Provider\DispatcherFactory; |
| 16 | +use Joomla\CMS\Extension\Service\Provider\MVCFactoryFactory; |
| 17 | +use Joomla\CMS\MVC\Factory\MVCFactoryFactoryInterface; |
| 18 | +use Joomla\DI\Container; |
| 19 | +use Joomla\DI\ServiceProviderInterface; |
| 20 | + |
| 21 | +/** |
| 22 | + * The finder service provider. |
| 23 | + * |
| 24 | + * @since 4.0.0 |
| 25 | + */ |
| 26 | +return new class implements ServiceProviderInterface |
| 27 | +{ |
| 28 | + /** |
| 29 | + * Registers the service provider with a DI container. |
| 30 | + * |
| 31 | + * @param Container $container The DI container. |
| 32 | + * |
| 33 | + * @return void |
| 34 | + * |
| 35 | + * @since 4.0.0 |
| 36 | + */ |
| 37 | + public function register(Container $container) |
| 38 | + { |
| 39 | + $container->registerServiceProvider(new MVCFactoryFactory('\\Joomla\\Component\\Finder')); |
| 40 | + $container->registerServiceProvider(new DispatcherFactory('\\Joomla\\Component\\Finder')); |
| 41 | + $container->set( |
| 42 | + ComponentInterface::class, |
| 43 | + function (Container $container) |
| 44 | + { |
| 45 | + $component = new MVCComponent($container->get(DispatcherFactoryInterface::class)); |
| 46 | + $component->setMvcFactoryFactory($container->get(MVCFactoryFactoryInterface::class)); |
| 47 | + |
| 48 | + return $component; |
| 49 | + } |
| 50 | + ); |
| 51 | + } |
| 52 | +}; |
0 commit comments