PluginProbe
Image Optimizer – Compress Images and Convert to WebP or AVIF / 1.5.4
Image Optimizer – Compress Images and Convert to WebP or AVIF v1.5.4
1.7.7 1.7.6 1.7.5 1.7.4 trunk 1.0.0 1.0.1 1.0.2 1.1.0 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 All 33 releases
image-optimization / vendor / woocommerce / action-scheduler / classes / migration / Config.php

Config.php in Image Optimizer – Compress Images and Convert to WebP or AVIF 1.5.4, at vendor/woocommerce/action-scheduler/classes/migration/Config.php

173 lines 3.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 namespace Action_Scheduler\Migration;
5
6 use Action_Scheduler\WP_CLI\ProgressBar;
7 use ActionScheduler_Logger as Logger;
8 use ActionScheduler_Store as Store;
9
10 /**
11 * Class Config
12 *
13 * @package Action_Scheduler\Migration
14 *
15 * @since 3.0.0
16 *
17 * A config builder for the ActionScheduler\Migration\Runner class
18 */
19 class Config {
20 /** @var ActionScheduler_Store */
21 private $source_store;
22
23 /** @var ActionScheduler_Logger */
24 private $source_logger;
25
26 /** @var ActionScheduler_Store */
27 private $destination_store;
28
29 /** @var ActionScheduler_Logger */
30 private $destination_logger;
31
32 /** @var Progress bar */
33 private $progress_bar;
34
35 /** @var bool */
36 private $dry_run = false;
37
38 /**
39 * Config constructor.
40 */
41 public function __construct() {
42
43 }
44
45 /**
46 * Get the configured source store.
47 *
48 * @return ActionScheduler_Store
49 * @throws \RuntimeException When source store is not configured.
50 */
51 public function get_source_store() {
52 if ( empty( $this->source_store ) ) {
53 throw new \RuntimeException( __( 'Source store must be configured before running a migration', 'action-scheduler' ) );
54 }
55
56 return $this->source_store;
57 }
58
59 /**
60 * Set the configured source store.
61 *
62 * @param ActionScheduler_Store $store Source store object.
63 */
64 public function set_source_store( Store $store ) {
65 $this->source_store = $store;
66 }
67
68 /**
69 * Get the configured source logger.
70 *
71 * @return ActionScheduler_Logger
72 * @throws \RuntimeException When source logger is not configured.
73 */
74 public function get_source_logger() {
75 if ( empty( $this->source_logger ) ) {
76 throw new \RuntimeException( __( 'Source logger must be configured before running a migration', 'action-scheduler' ) );
77 }
78
79 return $this->source_logger;
80 }
81
82 /**
83 * Set the configured source logger.
84 *
85 * @param ActionScheduler_Logger $logger Logger object.
86 */
87 public function set_source_logger( Logger $logger ) {
88 $this->source_logger = $logger;
89 }
90
91 /**
92 * Get the configured destination store.
93 *
94 * @return ActionScheduler_Store
95 * @throws \RuntimeException When destination store is not configured.
96 */
97 public function get_destination_store() {
98 if ( empty( $this->destination_store ) ) {
99 throw new \RuntimeException( __( 'Destination store must be configured before running a migration', 'action-scheduler' ) );
100 }
101
102 return $this->destination_store;
103 }
104
105 /**
106 * Set the configured destination store.
107 *
108 * @param ActionScheduler_Store $store Action store object.
109 */
110 public function set_destination_store( Store $store ) {
111 $this->destination_store = $store;
112 }
113
114 /**
115 * Get the configured destination logger.
116 *
117 * @return ActionScheduler_Logger
118 * @throws \RuntimeException When destination logger is not configured.
119 */
120 public function get_destination_logger() {
121 if ( empty( $this->destination_logger ) ) {
122 throw new \RuntimeException( __( 'Destination logger must be configured before running a migration', 'action-scheduler' ) );
123 }
124
125 return $this->destination_logger;
126 }
127
128 /**
129 * Set the configured destination logger.
130 *
131 * @param ActionScheduler_Logger $logger Logger object.
132 */
133 public function set_destination_logger( Logger $logger ) {
134 $this->destination_logger = $logger;
135 }
136
137 /**
138 * Get flag indicating whether it's a dry run.
139 *
140 * @return bool
141 */
142 public function get_dry_run() {
143 return $this->dry_run;
144 }
145
146 /**
147 * Set flag indicating whether it's a dry run.
148 *
149 * @param bool $dry_run Dry run toggle.
150 */
151 public function set_dry_run( $dry_run ) {
152 $this->dry_run = (bool) $dry_run;
153 }
154
155 /**
156 * Get progress bar object.
157 *
158 * @return ActionScheduler\WPCLI\ProgressBar
159 */
160 public function get_progress_bar() {
161 return $this->progress_bar;
162 }
163
164 /**
165 * Set progress bar object.
166 *
167 * @param ActionScheduler\WPCLI\ProgressBar $progress_bar Progress bar object.
168 */
169 public function set_progress_bar( ProgressBar $progress_bar ) {
170 $this->progress_bar = $progress_bar;
171 }
172 }
173