Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <fabien@symfony.com>
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 Symfony\Component\HttpKernel\Bundle;
13
 
14
use Symfony\Component\Config\Definition\Configurator\DefinitionConfigurator;
15
use Symfony\Component\DependencyInjection\Container;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Extension\ConfigurableExtensionInterface;
18
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
19
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
20
 
21
/**
22
 * A Bundle that provides configuration hooks.
23
 *
24
 * @author Yonel Ceruto <yonelceruto@gmail.com>
25
 */
26
abstract class AbstractBundle extends Bundle implements ConfigurableExtensionInterface
27
{
28
    protected string $extensionAlias = '';
29
 
30
    public function configure(DefinitionConfigurator $definition): void
31
    {
32
    }
33
 
34
    public function prependExtension(ContainerConfigurator $container, ContainerBuilder $builder): void
35
    {
36
    }
37
 
38
    public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void
39
    {
40
    }
41
 
42
    public function getContainerExtension(): ?ExtensionInterface
43
    {
44
        if ('' === $this->extensionAlias) {
45
            $this->extensionAlias = Container::underscore(preg_replace('/Bundle$/', '', $this->getName()));
46
        }
47
 
48
        return $this->extension ??= new BundleExtension($this, $this->extensionAlias);
49
    }
50
 
51
    public function getPath(): string
52
    {
53
        if (null === $this->path) {
54
            $reflected = new \ReflectionObject($this);
55
            // assume the modern directory structure by default
56
            $this->path = \dirname($reflected->getFileName(), 2);
57
        }
58
 
59
        return $this->path;
60
    }
61
}