Admin
5 years ago
Helpers
5 years ago
Migrations
5 years ago
MigrationLogFactory.php
5 years ago
MigrationLogModel.php
5 years ago
MigrationLogRepository.php
5 years ago
MigrationLogServiceProvider.php
5 years ago
MigrationLogStatus.php
5 years ago
MigrationLogStatus.php
49 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 | const SUCCESS = 'success'; |
| 13 | const FAILED = 'failed'; |
| 14 | const PENDING = 'pending'; |
| 15 | |
| 16 | /** |
| 17 | * Get default migration status |
| 18 | * |
| 19 | * @return string |
| 20 | */ |
| 21 | public static function getDefault() { |
| 22 | return MigrationLogStatus::FAILED; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Get all migration statuses |
| 27 | * |
| 28 | * @return array |
| 29 | */ |
| 30 | public static function getAll() { |
| 31 | return [ |
| 32 | MigrationLogStatus::SUCCESS => esc_html__( 'Success', 'give' ), |
| 33 | MigrationLogStatus::FAILED => esc_html__( 'Failed', 'give' ), |
| 34 | MigrationLogStatus::PENDING => esc_html__( 'Pending', 'give' ), |
| 35 | ]; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Check if value is a valid migration status |
| 40 | * |
| 41 | * @param string $status |
| 42 | * |
| 43 | * @return bool |
| 44 | */ |
| 45 | public static function isValid( $status ) { |
| 46 | return array_key_exists( $status, self::getAll() ); |
| 47 | } |
| 48 | } |
| 49 |