private function process_admin_settings()
 {
     // validate
     if (!isset($_GET['id'])) {
         return new WP_Error('woocommerce_pos_settings_error', __('There is no settings id', 'woocommerce-pos'), array('status' => 400));
     }
     $id = $_GET['id'];
     $data = WC_POS_Server::get_raw_data();
     // special case: gateway_
     $gateway_id = preg_replace('/^gateway_/', '', strtolower($id), 1, $count);
     if ($count) {
         $handler = new WC_POS_Admin_Settings_Gateways($gateway_id);
         // else, find handler by id
     } else {
         $handlers = (array) WC_POS_Admin_Settings::handlers();
         if (!isset($handlers[$id])) {
             return new WP_Error('woocommerce_pos_settings_error', sprintf(__('No handler found for %s settings', 'woocommerce-pos'), $_GET['id']), array('status' => 400));
         }
         $handler = new $handlers[$id]();
     }
     // Compatibility for clients that can't use PUT/PATCH/DELETE
     $method = strtoupper($_SERVER['REQUEST_METHOD']);
     if (isset($_GET['_method'])) {
         $method = strtoupper($_GET['_method']);
     } elseif (isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
         $method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
     }
     // get
     if ($method === 'GET') {
         return $handler->get();
     }
     // set
     if ($method === 'POST' || $method === 'PUT') {
         return $handler->set($data);
     }
     // delete
     if ($method === 'DELETE') {
         return $handler->delete($data);
     }
     return new WP_Error('woocommerce_pos_cannot_' . $method . '_' . $id, __('Settings error', 'woocommerce-pos'), array('status' => 405));
 }
/**
 * @param $id
 * @param $key
 * @return bool
 */
function wc_pos_get_option($id, $key = false)
{
    $handlers = (array) WC_POS_Admin_Settings::handlers();
    if (!array_key_exists($id, $handlers)) {
        return false;
    }
    $settings = $handlers[$id]::get_instance();
    return $settings->get($key);
}
/**
 * @param $id
 * @param $key
 * @return bool
 */
function wc_pos_get_option($id, $key = false)
{
    $handlers = (array) WC_POS_Admin_Settings::handlers();
    if (!array_key_exists($id, $handlers)) {
        return false;
    }
    // Singleton class uses late static binding, ie: PHP 5.3+
    if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
        $settings = $handlers[$id]::get_instance();
    } else {
        $settings = new $handlers[$id]();
    }
    return $settings->get($key);
}