← All changes
|
libraries/action-scheduler/classes/migration/Config.php
+40
-12
1.0.2
→
3.1.1
View file →
| @@ -16,24 +16,48 @@ | ||
| 16 | 16 | * |
| 17 | 17 | * A config builder for the ActionScheduler\Migration\Runner class |
| 18 | 18 | */ |
| 19 | 19 | class Config { |
| 20 | - /** @var ActionScheduler_Store */ | |
| 20 | + /** | |
| 21 | + * Source store instance. | |
| 22 | + * | |
| 23 | + * @var ActionScheduler_Store | |
| 24 | + */ | |
| 21 | 25 | private $source_store; |
| 22 | 26 | |
| 23 | - /** @var ActionScheduler_Logger */ | |
| 27 | + /** | |
| 28 | + * Source logger instance. | |
| 29 | + * | |
| 30 | + * @var ActionScheduler_Logger | |
| 31 | + */ | |
| 24 | 32 | private $source_logger; |
| 25 | 33 | |
| 26 | - /** @var ActionScheduler_Store */ | |
| 34 | + /** | |
| 35 | + * Destination store instance. | |
| 36 | + * | |
| 37 | + * @var ActionScheduler_Store | |
| 38 | + */ | |
| 27 | 39 | private $destination_store; |
| 28 | 40 | |
| 29 | - /** @var ActionScheduler_Logger */ | |
| 41 | + /** | |
| 42 | + * Destination logger instance. | |
| 43 | + * | |
| 44 | + * @var ActionScheduler_Logger | |
| 45 | + */ | |
| 30 | 46 | private $destination_logger; |
| 31 | 47 | |
| 32 | - /** @var Progress bar */ | |
| 48 | + /** | |
| 49 | + * Progress bar object. | |
| 50 | + * | |
| 51 | + * @var Action_Scheduler\WP_CLI\ProgressBar | |
| 52 | + */ | |
| 33 | 53 | private $progress_bar; |
| 34 | 54 | |
| 35 | - /** @var bool */ | |
| 55 | + /** | |
| 56 | + * Flag indicating a dryrun. | |
| 57 | + * | |
| 58 | + * @var bool | |
| 59 | + */ | |
| 36 | 60 | private $dry_run = false; |
| 37 | 61 | |
| 38 | 62 | /** |
| 39 | 63 | * Config constructor. |
| @@ -45,8 +69,9 @@ | ||
| 45 | 69 | /** |
| 46 | 70 | * Get the configured source store. |
| 47 | 71 | * |
| 48 | 72 | * @return ActionScheduler_Store |
| 73 | + * @throws \RuntimeException When source store is not configured. | |
| 49 | 74 | */ |
| 50 | 75 | public function get_source_store() { |
| 51 | 76 | if ( empty( $this->source_store ) ) { |
| 52 | 77 | throw new \RuntimeException( __( 'Source store must be configured before running a migration', 'action-scheduler' ) ); |
| @@ -64,11 +89,12 @@ | ||
| 64 | 89 | $this->source_store = $store; |
| 65 | 90 | } |
| 66 | 91 | |
| 67 | 92 | /** |
| 68 | - * Get the configured source loger. | |
| 93 | + * Get the configured source logger. | |
| 69 | 94 | * |
| 70 | 95 | * @return ActionScheduler_Logger |
| 96 | + * @throws \RuntimeException When source logger is not configured. | |
| 71 | 97 | */ |
| 72 | 98 | public function get_source_logger() { |
| 73 | 99 | if ( empty( $this->source_logger ) ) { |
| 74 | 100 | throw new \RuntimeException( __( 'Source logger must be configured before running a migration', 'action-scheduler' ) ); |
| @@ -79,9 +105,9 @@ | ||
| 79 | 105 | |
| 80 | 106 | /** |
| 81 | 107 | * Set the configured source logger. |
| 82 | 108 | * |
| 83 | - * @param ActionScheduler_Logger $logger | |
| 109 | + * @param ActionScheduler_Logger $logger Logger object. | |
| 84 | 110 | */ |
| 85 | 111 | public function set_source_logger( Logger $logger ) { |
| 86 | 112 | $this->source_logger = $logger; |
| 87 | 113 | } |
| @@ -89,8 +115,9 @@ | ||
| 89 | 115 | /** |
| 90 | 116 | * Get the configured destination store. |
| 91 | 117 | * |
| 92 | 118 | * @return ActionScheduler_Store |
| 119 | + * @throws \RuntimeException When destination store is not configured. | |
| 93 | 120 | */ |
| 94 | 121 | public function get_destination_store() { |
| 95 | 122 | if ( empty( $this->destination_store ) ) { |
| 96 | 123 | throw new \RuntimeException( __( 'Destination store must be configured before running a migration', 'action-scheduler' ) ); |
| @@ -101,9 +128,9 @@ | ||
| 101 | 128 | |
| 102 | 129 | /** |
| 103 | 130 | * Set the configured destination store. |
| 104 | 131 | * |
| 105 | - * @param ActionScheduler_Store $store | |
| 132 | + * @param ActionScheduler_Store $store Action store object. | |
| 106 | 133 | */ |
| 107 | 134 | public function set_destination_store( Store $store ) { |
| 108 | 135 | $this->destination_store = $store; |
| 109 | 136 | } |
| @@ -111,8 +138,9 @@ | ||
| 111 | 138 | /** |
| 112 | 139 | * Get the configured destination logger. |
| 113 | 140 | * |
| 114 | 141 | * @return ActionScheduler_Logger |
| 142 | + * @throws \RuntimeException When destination logger is not configured. | |
| 115 | 143 | */ |
| 116 | 144 | public function get_destination_logger() { |
| 117 | 145 | if ( empty( $this->destination_logger ) ) { |
| 118 | 146 | throw new \RuntimeException( __( 'Destination logger must be configured before running a migration', 'action-scheduler' ) ); |
| @@ -123,9 +151,9 @@ | ||
| 123 | 151 | |
| 124 | 152 | /** |
| 125 | 153 | * Set the configured destination logger. |
| 126 | 154 | * |
| 127 | - * @param ActionScheduler_Logger $logger | |
| 155 | + * @param ActionScheduler_Logger $logger Logger object. | |
| 128 | 156 | */ |
| 129 | 157 | public function set_destination_logger( Logger $logger ) { |
| 130 | 158 | $this->destination_logger = $logger; |
| 131 | 159 | } |
| @@ -141,9 +169,9 @@ | ||
| 141 | 169 | |
| 142 | 170 | /** |
| 143 | 171 | * Set flag indicating whether it's a dry run. |
| 144 | 172 | * |
| 145 | - * @param bool $dry_run | |
| 173 | + * @param bool $dry_run Dry run toggle. | |
| 146 | 174 | */ |
| 147 | 175 | public function set_dry_run( $dry_run ) { |
| 148 | 176 | $this->dry_run = (bool) $dry_run; |
| 149 | 177 | } |
| @@ -159,9 +187,9 @@ | ||
| 159 | 187 | |
| 160 | 188 | /** |
| 161 | 189 | * Set progress bar object. |
| 162 | 190 | * |
| 163 | - * @param ActionScheduler\WPCLI\ProgressBar $progress_bar | |
| 191 | + * @param ActionScheduler\WPCLI\ProgressBar $progress_bar Progress bar object. | |
| 164 | 192 | */ |
| 165 | 193 | public function set_progress_bar( ProgressBar $progress_bar ) { |
| 166 | 194 | $this->progress_bar = $progress_bar; |
| 167 | 195 | } |