<?php
namespace PayCal\Modules\Bit;

defined('ABSPATH') || exit;

class BitSettings {
  const OPTION = 'paycal_bit_settings';

  public static function get(): array {
    $v = get_option(self::OPTION, []);
    return is_array($v) ? $v : [];
  }

  public static function set(array $data): void {
    update_option(self::OPTION, $data, false);
  }

  public static function phone(): string {
    $s = self::get();
    return preg_replace('/\D+/', '', (string)($s['phone'] ?? ''));
  }
}
