1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Micro framework package. |
5
|
|
|
* |
6
|
|
|
* (c) Stanislau Komar <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Micro\Plugin\Configuration\Helper; |
13
|
|
|
|
14
|
|
|
use Micro\Component\DependencyInjection\Container; |
15
|
|
|
use Micro\Framework\Kernel\KernelInterface; |
16
|
|
|
use Micro\Framework\Kernel\Plugin\DependencyProviderInterface; |
17
|
|
|
use Micro\Kernel\App\AppKernelInterface; |
18
|
|
|
use Micro\Plugin\Configuration\Helper\Business\Path\PathResolverFactory; |
19
|
|
|
use Micro\Plugin\Configuration\Helper\Business\Path\PathResolverFactoryInterface; |
20
|
|
|
use Micro\Plugin\Configuration\Helper\Business\Plugin\PluginClassResolverFactory; |
21
|
|
|
use Micro\Plugin\Configuration\Helper\Business\Plugin\PluginClassResolverFactoryInterface; |
22
|
|
|
use Micro\Plugin\Configuration\Helper\Business\Plugin\PluginClassResolverInterface; |
23
|
|
|
use Micro\Plugin\Configuration\Helper\Facade\ConfigurationHelperFacade; |
24
|
|
|
use Micro\Plugin\Configuration\Helper\Facade\ConfigurationHelperFacadeInterface; |
25
|
|
|
|
26
|
|
|
class ConfigurationHelperPlugin implements DependencyProviderInterface |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* {@inheritDoc} |
30
|
|
|
*/ |
31
|
1 |
|
public function provideDependencies(Container $container): void |
32
|
|
|
{ |
33
|
1 |
|
$container->register(ConfigurationHelperFacadeInterface::class, function (AppKernelInterface $kernel) { |
34
|
1 |
|
return $this->createFacade($kernel); |
35
|
1 |
|
}); |
36
|
|
|
} |
37
|
|
|
|
38
|
1 |
|
protected function createFacade(KernelInterface $kernel): ConfigurationHelperFacadeInterface |
39
|
|
|
{ |
40
|
1 |
|
$classResolverFactory = $this->createPluginClassResolverFactory($kernel); |
41
|
1 |
|
$classResolver = $classResolverFactory->create(); |
42
|
1 |
|
$pathResolver = $this->createPathResolverFactoryInterface($classResolver)->create(); |
43
|
|
|
|
44
|
1 |
|
return new ConfigurationHelperFacade($pathResolver); |
45
|
|
|
} |
46
|
|
|
|
47
|
1 |
|
protected function createPluginClassResolverFactory(KernelInterface $kernel): PluginClassResolverFactoryInterface |
48
|
|
|
{ |
49
|
1 |
|
return new PluginClassResolverFactory($kernel); |
50
|
|
|
} |
51
|
|
|
|
52
|
1 |
|
protected function createPathResolverFactoryInterface(PluginClassResolverInterface $pluginClassResolver): PathResolverFactoryInterface |
53
|
|
|
{ |
54
|
1 |
|
return new PathResolverFactory($pluginClassResolver); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|