# simpleanalytics/1.85/src/Setting.php

Simple Analytics, version 1.85. 39 lines.

- Page: https://pluginprobe.com/plugins/simpleanalytics/1.85/code/src/Setting.php
- Raw: https://pluginprobe.com/plugins/simpleanalytics/1.85/raw/src/Setting.php
- Modified: 2024-11-21T15:59:46+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/simpleanalytics/1.85/code/src/Setting.php#L10-L20`.

```php
<?php

namespace SimpleAnalytics;

class Setting
{
    /**
     * @return mixed
     */
    public static function get(string $key, $default = null)
    {
        $value = get_option($key);

        if (empty($value)) {
            return $default;
        }

        return $value;
    }

    public static function boolean(string $key, ?bool $default = null): ?bool
    {
        $value = get_option($key, null);

        if ($value === null || $value === '') {
            return $default;
        }

        return (bool)$value;
    }

    public static function array(string $key): array
    {
        $value = self::get($key, []);

        return is_array($value) ? $value : [$value];
    }
}

```
