AsyncRequest.php
2 years ago
AsyncWebhookService.php
2 years ago
BackgroundServiceProvider.php
2 years ago
CustomerSyncService.php
3 years ago
QueueService.php
2 years ago
SyncService.php
3 years ago
BackgroundServiceProvider.php
47 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Background; |
| 4 | |
| 5 | use SureCartCore\ServiceProviders\ServiceProviderInterface; |
| 6 | |
| 7 | /** |
| 8 | * WordPress Users service. |
| 9 | */ |
| 10 | class BackgroundServiceProvider 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.sync'] = function () use ( $container ) { |
| 19 | return new SyncService(); |
| 20 | }; |
| 21 | |
| 22 | $container['surecart.queue'] = function () use ( $container ) { |
| 23 | return new QueueService(); |
| 24 | }; |
| 25 | |
| 26 | $container['surecart.async.webhooks'] = function() { |
| 27 | return new AsyncWebhookService(); |
| 28 | }; |
| 29 | |
| 30 | $app = $container[ SURECART_APPLICATION_KEY ]; |
| 31 | $app->alias( 'sync', 'surecart.sync' ); |
| 32 | $app->alias( 'queue', 'surecart.queue' ); |
| 33 | $app->alias( 'async', 'surecart.async.webhooks' ); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Bootstrap any services if needed. |
| 38 | * |
| 39 | * @param \Pimple\Container $container Service container. |
| 40 | * @return void |
| 41 | */ |
| 42 | public function bootstrap( $container ) { |
| 43 | $container['surecart.sync']->customers()->bootstrap(); |
| 44 | $container['surecart.async.webhooks']->bootstrap(); |
| 45 | } |
| 46 | } |
| 47 |