| Server IP : 216.238.66.20 / Your IP : 216.73.216.199 Web Server : nginx/1.30.4 System : Linux woropds 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/sweetheart.mx/htdocs/wp-content/plugins/backwpup/src/Admin/ |
Upload File : |
<?php
declare(strict_types=1);
namespace WPMedia\BackWPup\Admin;
class OptionData {
/**
* Option data
*
* @var array Array of data inside the option
*/
private $options;
/**
* Constructor
*
* @param array $options Array of data coming from an option.
*/
public function __construct( array $options ) {
$this->options = $options;
}
/**
* Checks if the provided key exists in the option data array.
*
* @param string $key key name.
* @return boolean true if it exists, false otherwise
*/
public function has( string $key ): bool {
return isset( $this->options[ $key ] );
}
/**
* Sets the value associated with a specific key.
*
* @param string $key key name.
* @param mixed $value The value to set.
*
* @return void
*/
public function set( string $key, $value ) {
$this->options[ $key ] = $value;
}
/**
* Sets multiple values.
*
* @param array $options An array of key/value pairs to set.
* @return void
*/
public function set_values( array $options ): void {
foreach ( $options as $key => $value ) {
$this->set( $key, $value );
}
}
/**
* Gets all available option array.
*
* @return array
*/
public function get_options(): array {
return $this->options;
}
/**
* Gets the value associated with a specific key.
*
* @param string $key key name.
* @param mixed $default default value to return if key doesn't exist.
* @return mixed
*/
public function get( string $key, $default = '' ) {
if ( ! $this->has( $key ) ) {
return $default;
}
return $this->options[ $key ];
}
}