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