Cleanup
1 year ago
Sync
1 year ago
CleanupJob.php
1 year ago
JobService.php
1 year ago
SyncJob.php
1 year ago
SyncJob.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Sync\Jobs; |
| 4 | |
| 5 | /** |
| 6 | * Sync job. |
| 7 | * |
| 8 | * Handles the sync process for the products. |
| 9 | */ |
| 10 | class SyncJob { |
| 11 | /** |
| 12 | * The app. |
| 13 | * |
| 14 | * @var \SureCart\App |
| 15 | */ |
| 16 | protected $app; |
| 17 | |
| 18 | /** |
| 19 | * Constructor. |
| 20 | * |
| 21 | * @param \SureCart\App $app The app. |
| 22 | */ |
| 23 | public function __construct( $app ) { |
| 24 | $this->app = $app; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Cancel all jobs. |
| 29 | * |
| 30 | * @return void |
| 31 | */ |
| 32 | public function cancel() { |
| 33 | $this->products()->cancel(); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Is the sync active? |
| 38 | * |
| 39 | * @return boolean |
| 40 | */ |
| 41 | public function isActive() { |
| 42 | return $this->products()->isRunning(); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Get the sync process. |
| 47 | * |
| 48 | * @return \SureCart\Sync\SyncProcess |
| 49 | */ |
| 50 | public function products() { |
| 51 | return $this->app->resolve( 'surecart.jobs.sync.products' ); |
| 52 | } |
| 53 | } |
| 54 |