Something went wrong. Try again.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738<?php
declare(strict_types=1);
namespace Wotnak\Atproto\Identifier;
/** * Value object for a normalized handle. * * @api */final readonly class Handle {
/** * @param string[] $labels * Handle labels. */ public function __construct( public string $value, public array $labels, ) { if (!new HandleParser()->isValid($value) || $value !== \strtolower($value)) { throw new \InvalidArgumentException(\sprintf('Invalid normalized handle "%s".', $value)); } if ($labels !== \explode('.', $value)) { throw new \InvalidArgumentException('Handle labels do not match the normalized value.'); } }
/** * Returns the canonical string representation. */ public function __toString(): string { return $this->value; }
}