| @@ -5,8 +5,10 @@ | ||
| 5 | 5 | /** |
| 6 | 6 | * Class MigrationLogStatus |
| 7 | 7 | * @package Give\MigrationLog |
| 8 | 8 | * |
| 9 | + * @since 4.3.0 add REVERSED status | |
| 10 | + * @since 4.0.0 add RUNNING and INCOMPLETE statuses | |
| 9 | 11 | * @since 2.10.0 |
| 10 | 12 | */ |
| 11 | 13 | class MigrationLogStatus |
| 12 | 14 | { |
| @@ -12,15 +14,16 @@ | ||
| 12 | 14 | { |
| 13 | 15 | const SUCCESS = 'success'; |
| 14 | 16 | const FAILED = 'failed'; |
| 15 | 17 | const PENDING = 'pending'; |
| 18 | + const RUNNING = 'running'; | |
| 19 | + const INCOMPLETE = 'incomplete'; | |
| 20 | + const REVERSED = 'reversed'; | |
| 16 | 21 | |
| 17 | 22 | /** |
| 18 | 23 | * Get default migration status |
| 19 | - * | |
| 20 | - * @return string | |
| 21 | 24 | */ |
| 22 | - public static function getDefault() | |
| 25 | + public static function getDefault(): string | |
| 23 | 26 | { |
| 24 | 27 | return MigrationLogStatus::FAILED; |
| 25 | 28 | } |
| 26 | 29 | |
| @@ -25,28 +28,25 @@ | ||
| 25 | 28 | } |
| 26 | 29 | |
| 27 | 30 | /** |
| 28 | 31 | * Get all migration statuses |
| 29 | - * | |
| 30 | - * @return array | |
| 31 | 32 | */ |
| 32 | - public static function getAll() | |
| 33 | + public static function getAll(): array | |
| 33 | 34 | { |
| 34 | 35 | return [ |
| 35 | 36 | MigrationLogStatus::SUCCESS => esc_html__('Success', 'give'), |
| 36 | 37 | MigrationLogStatus::FAILED => esc_html__('Failed', 'give'), |
| 37 | 38 | MigrationLogStatus::PENDING => esc_html__('Pending', 'give'), |
| 39 | + MigrationLogStatus::RUNNING => esc_html__('Running', 'give'), | |
| 40 | + MigrationLogStatus::INCOMPLETE => esc_html__('Incomplete', 'give'), | |
| 41 | + MigrationLogStatus::REVERSED => esc_html__('Pending', 'give'), | |
| 38 | 42 | ]; |
| 39 | 43 | } |
| 40 | 44 | |
| 41 | 45 | /** |
| 42 | 46 | * Check if value is a valid migration status |
| 43 | - * | |
| 44 | - * @param string $status | |
| 45 | - * | |
| 46 | - * @return bool | |
| 47 | 47 | */ |
| 48 | - public static function isValid($status) | |
| 48 | + public static function isValid(string $status): bool | |
| 49 | 49 | { |
| 50 | 50 | return array_key_exists($status, self::getAll()); |
| 51 | 51 | } |
| 52 | 52 | } |