1: <?php
2:
3: namespace Charcoal\Ui\ServiceProvider;
4:
5: use \Pimple\Container;
6: use \Pimple\ServiceProviderInterface;
7:
8: use \Charcoal\Factory\GenericFactory as Factory;
9:
10: use \Charcoal\Ui\Dashboard\DashboardBuilder;
11: use \Charcoal\Ui\Dashboard\DashboardInterface;
12: use \Charcoal\Ui\Dashboard\GenericDashboard;
13:
14: 15: 16:
17: class DashboardServiceProvider implements ServiceProviderInterface
18: {
19: 20: 21: 22:
23: public function register(Container $container)
24: {
25: $this->registerDashboardServices($container);
26: }
27:
28: 29: 30: 31:
32: private function registerDashboardServices(Container $container)
33: {
34: 35: 36: 37:
38: $container['dashboard/factory'] = function (Container $container) {
39: return new Factory([
40: 'base_class' => DashboardInterface::class,
41: 'default_class' => GenericDashboard::class,
42: 'arguments' => [[
43: 'container' => $container,
44: 'logger' => $container['logger'],
45: 'widget_builder' => $container['widget/builder'],
46: 'layout_builder' => $container['layout/builder']
47: ]],
48: 'resolver_options' => [
49: 'suffix' => 'Dashboard'
50: ]
51: ]);
52: };
53:
54: 55: 56: 57:
58: $container['dashboard/builder'] = function (Container $container) {
59: $dashboardFactory = $container['dashboard/factory'];
60: $dashboardBuilder = new DashboardBuilder($dashboardFactory, $container);
61: return $dashboardBuilder;
62: };
63: }
64: }
65: