|
| 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 | +namespaceSymfony\Component\HttpKernel; |
| 13 | + |
| 14 | +useSymfony\Bundle\FrameworkBundle\Routing\RouteCollectionBuilder; |
| 15 | +useSymfony\Component\Config\Loader\LoaderInterface; |
| 16 | +useSymfony\Component\Config\Resource\FileResource; |
| 17 | +useSymfony\Component\DependencyInjection\ContainerBuilder; |
| 18 | + |
| 19 | +/** |
| 20 | + * A Kernel that provides configuration hooks. |
| 21 | + * |
| 22 | + * @author Ryan Weaver <ryan@knpuniversity.com> |
| 23 | + * @author Fabien Potencier <fabien@symfony.com> |
| 24 | + */ |
| 25 | +abstractclass MicroKernelextends Kernel |
| 26 | +{ |
| 27 | +/** |
| 28 | + * Add or import routes into your application. |
| 29 | + * |
| 30 | + * $routes->import('config/routing.yml'); |
| 31 | + * $routes->add('/admin', 'AppBundle:Admin:dashboard', 'admin_dashboard'); |
| 32 | + * |
| 33 | + * @param RouteCollectionBuilder $routes |
| 34 | + */ |
| 35 | +protectedfunctionconfigureRoutes(RouteCollectionBuilder$routes) |
| 36 | + { |
| 37 | + } |
| 38 | + |
| 39 | +/** |
| 40 | + * Configures container extensions. |
| 41 | + * |
| 42 | + * $c->loadFromExtension('framework', array( |
| 43 | + * 'secret' => '%secret%' |
| 44 | + * )); |
| 45 | + * |
| 46 | + * @param ContainerBuilder $c |
| 47 | + * @param LoaderInterface $loader |
| 48 | + */ |
| 49 | +protectedfunctionconfigureExtensions(ContainerBuilder$c,LoaderInterface$loader) |
| 50 | + { |
| 51 | + } |
| 52 | + |
| 53 | +/** |
| 54 | + * Adds service definitions to the container. |
| 55 | + * |
| 56 | + * @param ContainerBuilder $c |
| 57 | + * @param LoaderInterface $loader |
| 58 | + */ |
| 59 | +protectedfunctionconfigureServices(ContainerBuilder$c,LoaderInterface$loader) |
| 60 | + { |
| 61 | + } |
| 62 | + |
| 63 | +/** |
| 64 | + * {@inheritdoc} |
| 65 | + */ |
| 66 | +publicfunctionregisterContainerConfiguration(LoaderInterface$loader) |
| 67 | + { |
| 68 | +$loader->load(function (ContainerBuilder$container)use ($loader) { |
| 69 | +$container->loadFromExtension('framework',array( |
| 70 | +'router' =>array( |
| 71 | +'resource' =>'kernel:loadRoutes', |
| 72 | +'type' =>'service', |
| 73 | + ), |
| 74 | + )); |
| 75 | + |
| 76 | +$this->configureExtensions($container,$loader); |
| 77 | +$this->configureServices($container,$loader); |
| 78 | + |
| 79 | +$container->addObjectResource($this); |
| 80 | + }); |
| 81 | + } |
| 82 | + |
| 83 | +privatefunctionloadRoutes(LoaderInterface$loader) |
| 84 | + { |
| 85 | +$routes =newRouteCollectionBuilder($loader); |
| 86 | +$this->configureRoutes($routes); |
| 87 | + |
| 88 | +return$routes->build(); |
| 89 | + } |
| 90 | +} |