- Move 12 markdown files from root to docs/ subdirectories - Organize documentation by category: • docs/troubleshooting/ (1 file) - Technical troubleshooting guides • docs/deployment/ (4 files) - Deployment and security documentation • docs/guides/ (3 files) - Feature-specific guides • docs/planning/ (4 files) - Planning and improvement proposals Root directory cleanup: - Reduced from 16 to 4 markdown files in root - Only essential project files remain: • CLAUDE.md (AI instructions) • README.md (Main project readme) • CLEANUP_PLAN.md (Current cleanup plan) • SRC_STRUCTURE_IMPROVEMENTS.md (Structure improvements) This improves: ✅ Documentation discoverability ✅ Logical organization by purpose ✅ Clean root directory ✅ Better maintainability
57 lines
1.2 KiB
PHP
57 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Domain\SmartLink\ValueObjects;
|
|
|
|
final readonly class DestinationUrl
|
|
{
|
|
private function __construct(
|
|
private string $value
|
|
) {
|
|
$this->validate();
|
|
}
|
|
|
|
public static function fromString(string $url): self
|
|
{
|
|
return new self($url);
|
|
}
|
|
|
|
private function validate(): void
|
|
{
|
|
if (!filter_var($this->value, FILTER_VALIDATE_URL)) {
|
|
throw new \InvalidArgumentException('Invalid destination URL format');
|
|
}
|
|
|
|
$scheme = parse_url($this->value, PHP_URL_SCHEME);
|
|
if (!in_array($scheme, ['http', 'https'], true)) {
|
|
throw new \InvalidArgumentException('Destination URL must use HTTP or HTTPS protocol');
|
|
}
|
|
}
|
|
|
|
public function toString(): string
|
|
{
|
|
return $this->value;
|
|
}
|
|
|
|
public function getHost(): string
|
|
{
|
|
return parse_url($this->value, PHP_URL_HOST) ?? '';
|
|
}
|
|
|
|
public function isSecure(): bool
|
|
{
|
|
return parse_url($this->value, PHP_URL_SCHEME) === 'https';
|
|
}
|
|
|
|
public function equals(self $other): bool
|
|
{
|
|
return $this->value === $other->value;
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->value;
|
|
}
|
|
}
|