Admin
4 years ago
Helpers
4 years ago
Migrations
4 years ago
MigrationLogFactory.php
4 years ago
MigrationLogModel.php
4 years ago
MigrationLogRepository.php
4 years ago
MigrationLogServiceProvider.php
4 years ago
MigrationLogStatus.php
4 years ago
MigrationLogStatus.php
53 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\MigrationLog; |
| 4 | |
| 5 | /** |
| 6 | * Class MigrationLogStatus |
| 7 | * @package Give\MigrationLog |
| 8 | * |
| 9 | * @since 2.10.0 |
| 10 | */ |
| 11 | class MigrationLogStatus |
| 12 | { |
| 13 | const SUCCESS = 'success'; |
| 14 | const FAILED = 'failed'; |
| 15 | const PENDING = 'pending'; |
| 16 | |
| 17 | /** |
| 18 | * Get default migration status |
| 19 | * |
| 20 | * @return string |
| 21 | */ |
| 22 | public static function getDefault() |
| 23 | { |
| 24 | return MigrationLogStatus::FAILED; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Get all migration statuses |
| 29 | * |
| 30 | * @return array |
| 31 | */ |
| 32 | public static function getAll() |
| 33 | { |
| 34 | return [ |
| 35 | MigrationLogStatus::SUCCESS => esc_html__('Success', 'give'), |
| 36 | MigrationLogStatus::FAILED => esc_html__('Failed', 'give'), |
| 37 | MigrationLogStatus::PENDING => esc_html__('Pending', 'give'), |
| 38 | ]; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Check if value is a valid migration status |
| 43 | * |
| 44 | * @param string $status |
| 45 | * |
| 46 | * @return bool |
| 47 | */ |
| 48 | public static function isValid($status) |
| 49 | { |
| 50 | return array_key_exists($status, self::getAll()); |
| 51 | } |
| 52 | } |
| 53 |