PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.1.0
GiveWP – Donation Plugin and Fundraising Platform v4.1.0
4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 All 253 releases
give / src / MigrationLog / MigrationLogStatus.php

MigrationLogStatus.php in GiveWP – Donation Plugin and Fundraising Platform 4.1.0, at src/MigrationLog/MigrationLogStatus.php

58 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\MigrationLog;
4
5 /**
6 * Class MigrationLogStatus
7 * @package Give\MigrationLog
8 *
9 * @since 4.0.0 add RUNNING and INCOMPLETE statuses
10 * @since 2.10.0
11 */
12 class MigrationLogStatus
13 {
14 const SUCCESS = 'success';
15 const FAILED = 'failed';
16 const PENDING = 'pending';
17 const RUNNING = 'running';
18 const INCOMPLETE = 'incomplete';
19
20 /**
21 * Get default migration status
22 *
23 * @return string
24 */
25 public static function getDefault()
26 {
27 return MigrationLogStatus::FAILED;
28 }
29
30 /**
31 * Get all migration statuses
32 *
33 * @return array
34 */
35 public static function getAll()
36 {
37 return [
38 MigrationLogStatus::SUCCESS => esc_html__('Success', 'give'),
39 MigrationLogStatus::FAILED => esc_html__('Failed', 'give'),
40 MigrationLogStatus::PENDING => esc_html__('Pending', 'give'),
41 MigrationLogStatus::RUNNING => esc_html__('Running', 'give'),
42 MigrationLogStatus::INCOMPLETE => esc_html__('Incomplete', 'give'),
43 ];
44 }
45
46 /**
47 * Check if value is a valid migration status
48 *
49 * @param string $status
50 *
51 * @return bool
52 */
53 public static function isValid($status)
54 {
55 return array_key_exists($status, self::getAll());
56 }
57 }
58