TenantAtlas/app/Support/Settings/SettingDefinition.php
ahmido e241e27853 Settings foundation: workspace controls (#119)
Implements the Settings foundation workspace controls.

Includes:
- Settings foundation UI/controls scoped to workspace context
- Related onboarding/consent flow adjustments as included in branch history

Testing:
- `vendor/bin/sail artisan test --compact --no-ansi --filter=SettingsFoundation`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #119
2026-02-16 01:11:24 +00:00

37 lines
715 B
PHP

<?php
declare(strict_types=1);
namespace App\Support\Settings;
use Closure;
final readonly class SettingDefinition
{
/**
* @param array<int, string> $rules
*/
public function __construct(
public string $domain,
public string $key,
public string $type,
public mixed $systemDefault,
public array $rules,
private ?Closure $normalizer = null,
) {}
public function dotKey(): string
{
return $this->domain.'.'.$this->key;
}
public function normalize(mixed $value): mixed
{
if ($this->normalizer instanceof Closure) {
return ($this->normalizer)($value);
}
return $value;
}
}