AccountServiceProvider.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Account; |
| 4 | |
| 5 | use SureCart\Support\Server; |
| 6 | use SureCartCore\ServiceProviders\ServiceProviderInterface; |
| 7 | |
| 8 | /** |
| 9 | * Provide users dependencies. |
| 10 | */ |
| 11 | class AccountServiceProvider implements ServiceProviderInterface { |
| 12 | /** |
| 13 | * Register all dependencies in the IoC container. |
| 14 | * |
| 15 | * @param \Pimple\Container $container Service container. |
| 16 | * @return void |
| 17 | */ |
| 18 | public function register( $container ) { |
| 19 | $container['surecart.account'] = function () { |
| 20 | return new AccountService( new Server( get_site_url() ) ); |
| 21 | }; |
| 22 | |
| 23 | $app = $container[ SURECART_APPLICATION_KEY ]; |
| 24 | $app->alias( 'account', 'surecart.account' ); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Bootstrap |
| 29 | * |
| 30 | * @param \Pimple\Container $container Service container. |
| 31 | * @return void |
| 32 | */ |
| 33 | public function bootstrap( $container ) { |
| 34 | if ( ! empty( $container['surecart.account'] ) ) { |
| 35 | $container['surecart.account']->bootstrap(); |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 |