Skip to content

Commit 5d0910c

Browse files
laoneowilsonge
authored andcommitted
Move com_finder to services (#21648)
1 parent 3ff395f commit 5d0910c

File tree

4 files changed

+52
-77
lines changed

4 files changed

+52
-77
lines changed

administrator/components/com_finder/dispatcher.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

administrator/components/com_finder/finder.php

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
};

components/com_finder/dispatcher.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)