1: <?php
2:
3: namespace Charcoal\Ui\ServiceProvider;
4:
5: use \Pimple\Container;
6: use \Pimple\ServiceProviderInterface;
7:
8: use \Charcoal\Ui\Layout\LayoutBuilder;
9: use \Charcoal\Ui\Layout\LayoutFactory;
10:
11: 12: 13:
14: class LayoutServiceProvider implements ServiceProviderInterface
15: {
16: 17: 18: 19:
20: public function register(Container $container)
21: {
22: $this->registerLayoutServices($container);
23: }
24:
25: 26: 27: 28:
29: private function registerLayoutServices(Container $container)
30: {
31: 32: 33: 34:
35: $container['layout/factory'] = function (Container $container) {
36:
37: $layoutFactory = new LayoutFactory();
38: return $layoutFactory;
39: };
40:
41: 42: 43: 44:
45: $container['layout/builder'] = function (Container $container) {
46: $layoutFactory = $container['layout/factory'];
47: $layoutBuilder = new LayoutBuilder($layoutFactory, $container);
48: return $layoutBuilder;
49: };
50: }
51: }
52: