1 | <?php |
||
2 | /** |
||
3 | * @package WPEmerge |
||
4 | * @author Atanas Angelov <[email protected]> |
||
5 | * @copyright 2018 Atanas Angelov |
||
6 | * @license https://www.gnu.org/licenses/gpl-2.0.html GPL-2.0 |
||
7 | * @link https://wpemerge.com/ |
||
8 | */ |
||
9 | |||
10 | namespace WPEmerge\View; |
||
11 | |||
12 | use WPEmerge\Facades\Application; |
||
13 | use WPEmerge\ServiceProviders\ExtendsConfigTrait; |
||
14 | use WPEmerge\ServiceProviders\ServiceProviderInterface; |
||
15 | |||
16 | /** |
||
17 | * Provide view dependencies |
||
18 | * |
||
19 | * @codeCoverageIgnore |
||
20 | */ |
||
21 | class ViewServiceProvider implements ServiceProviderInterface { |
||
22 | use ExtendsConfigTrait; |
||
23 | |||
24 | /** |
||
25 | * {@inheritDoc} |
||
26 | */ |
||
27 | public function register( $container ) { |
||
28 | $this->extendConfig( $container, 'views', '' ); |
||
29 | |||
30 | $container[ WPEMERGE_VIEW_SERVICE_KEY ] = function () { |
||
31 | return new \WPEmerge\View\ViewService(); |
||
32 | }; |
||
33 | |||
34 | $container[ WPEMERGE_VIEW_PHP_VIEW_ENGINE_KEY ] = function ( $c ) { |
||
35 | return new \WPEmerge\View\PhpViewEngine( $c[ WPEMERGE_CONFIG_KEY ]['views'] ); |
||
36 | }; |
||
37 | |||
38 | $container[ WPEMERGE_VIEW_ENGINE_KEY ] = $container->raw( WPEMERGE_VIEW_PHP_VIEW_ENGINE_KEY ); |
||
39 | |||
40 | Application::facade( 'View', \WPEmerge\Facades\View::class ); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
41 | Application::facade( 'ViewEngine', \WPEmerge\Facades\ViewEngine::class ); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritDoc} |
||
46 | */ |
||
47 | public function bootstrap( $container ) { |
||
48 | // Nothing to bootstrap. |
||
49 | } |
||
50 | } |
||
51 |