Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| Options | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
| get_option_name | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
12 | |||
| get_all_options | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | namespace NewfoldLabs\WP\Module\Installer\Data; |
| 3 | |
| 4 | /** |
| 5 | * Stores all the WordPress Options used in the module. |
| 6 | */ |
| 7 | final class Options { |
| 8 | /** |
| 9 | * Prefix for options in the module. |
| 10 | * |
| 11 | * @var string |
| 12 | */ |
| 13 | protected static $prefix = 'nfd_module_installer_'; |
| 14 | |
| 15 | /** |
| 16 | * List of all the options. |
| 17 | * |
| 18 | * @var array |
| 19 | */ |
| 20 | protected static $options = array( |
| 21 | 'plugins_init_status' => 'plugins_init_status', |
| 22 | 'plugin_install_queue' => 'plugin_install_queue', |
| 23 | 'plugin_activation_queue' => 'plugin_activation_queue', |
| 24 | 'plugin_deactivation_queue' => 'plugin_deactivation_queue', |
| 25 | 'plugin_uninstall_queue' => 'plugin_uninstall_queue', |
| 26 | 'theme_init_status' => 'theme_init_status', |
| 27 | 'theme_install_queue' => 'theme_install_queue', |
| 28 | ); |
| 29 | |
| 30 | /** |
| 31 | * Get option name for a given key. |
| 32 | * |
| 33 | * @param string $option_key The key for the Options::$options array. |
| 34 | * @param boolean $attach_prefix Attach the module prefix. |
| 35 | * @return string|boolean |
| 36 | */ |
| 37 | public static function get_option_name( $option_key, $attach_prefix = true ) { |
| 38 | return isset( self::$options[ $option_key ] ) |
| 39 | ? ( $attach_prefix |
| 40 | ? self::$prefix . self::$options[ $option_key ] |
| 41 | : self::$options[ $option_key ] |
| 42 | ) |
| 43 | : false; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Get the list of all options. |
| 48 | * |
| 49 | * @return array |
| 50 | */ |
| 51 | public static function get_all_options() { |
| 52 | return self::$options; |
| 53 | } |
| 54 | } |