# user-access-manager/2.3.13/src/Config/ConfigParameter.php

User Access Manager, version 2.3.13. 51 lines.

- Page: https://pluginprobe.com/plugins/user-access-manager/2.3.13/code/src/Config/ConfigParameter.php
- Raw: https://pluginprobe.com/plugins/user-access-manager/2.3.13/raw/src/Config/ConfigParameter.php
- Modified: 2026-07-14T06:51:54+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/user-access-manager/2.3.13/code/src/Config/ConfigParameter.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace UserAccessManager\Config;

use Exception;

abstract class ConfigParameter implements ConfigParameterInterface
{
    protected mixed $defaultValue = null;
    protected mixed $value = null;

    /**
     * @throws Exception
     */
    public function __construct(
        protected string $id,
        mixed $defaultValue = null
    ) {
        $this->validateValue($defaultValue);
        $this->defaultValue = $defaultValue;
    }

    public function getId(): string
    {
        return $this->id;
    }

    /**
     * @throws Exception
     */
    protected function validateValue($value): void
    {
        if ($this->isValidValue($value) === false) {
            throw new Exception("Wrong value '$value' type given for '$this->id'.'");
        }
    }

    public function setValue(mixed $value): void
    {
        $this->isValidValue($value);
        $this->value = $value;
    }

    public function getValue(): mixed
    {
        return ($this->value === null) ? $this->defaultValue : $this->value;
    }
}

```
