WebhooksServiceProvider.php
39 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Webhooks; |
| 4 | |
| 5 | use SureCart\Models\RegisteredWebhook; |
| 6 | use SureCartCore\ServiceProviders\ServiceProviderInterface; |
| 7 | |
| 8 | /** |
| 9 | * WordPress Users service. |
| 10 | */ |
| 11 | class WebhooksServiceProvider 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.webhooks'] = function () { |
| 20 | return new WebhooksService( new RegisteredWebhook() ); |
| 21 | }; |
| 22 | |
| 23 | $app = $container[ SURECART_APPLICATION_KEY ]; |
| 24 | $app->alias( 'webhooks', 'surecart.webhooks' ); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Bootstrap any services if needed. |
| 29 | * |
| 30 | * @param \Pimple\Container $container Service container. |
| 31 | * @return void |
| 32 | */ |
| 33 | public function bootstrap( $container ) { |
| 34 | if ( ! empty( $container['surecart.webhooks'] ) ) { |
| 35 | $container['surecart.webhooks']->bootstrap(); |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 |