- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
115 lines
2.3 KiB
PHP
115 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\Svg\ValueObjects\Text;
|
|
|
|
use App\Framework\Exception\ErrorCode;
|
|
use App\Framework\Exception\FrameworkException;
|
|
|
|
/**
|
|
* Value Object representing font weight
|
|
* Supports both numeric (100-900) and named weights
|
|
*/
|
|
final readonly class FontWeight
|
|
{
|
|
public function __construct(
|
|
public int $value
|
|
) {
|
|
if ($value < 100 || $value > 900 || $value % 100 !== 0) {
|
|
throw FrameworkException::create(
|
|
ErrorCode::VAL_OUT_OF_RANGE,
|
|
'Font weight must be between 100 and 900 in steps of 100'
|
|
)->withData(['value' => $value]);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Named font weights
|
|
*/
|
|
public static function thin(): self
|
|
{
|
|
return new self(100);
|
|
}
|
|
|
|
public static function extraLight(): self
|
|
{
|
|
return new self(200);
|
|
}
|
|
|
|
public static function light(): self
|
|
{
|
|
return new self(300);
|
|
}
|
|
|
|
public static function normal(): self
|
|
{
|
|
return new self(400);
|
|
}
|
|
|
|
public static function medium(): self
|
|
{
|
|
return new self(500);
|
|
}
|
|
|
|
public static function semiBold(): self
|
|
{
|
|
return new self(600);
|
|
}
|
|
|
|
public static function bold(): self
|
|
{
|
|
return new self(700);
|
|
}
|
|
|
|
public static function extraBold(): self
|
|
{
|
|
return new self(800);
|
|
}
|
|
|
|
public static function black(): self
|
|
{
|
|
return new self(900);
|
|
}
|
|
|
|
/**
|
|
* Get named weight if applicable
|
|
*/
|
|
public function getNamedWeight(): ?string
|
|
{
|
|
return match ($this->value) {
|
|
100 => 'thin',
|
|
200 => 'extra-light',
|
|
300 => 'light',
|
|
400 => 'normal',
|
|
500 => 'medium',
|
|
600 => 'semi-bold',
|
|
700 => 'bold',
|
|
800 => 'extra-bold',
|
|
900 => 'black',
|
|
default => null,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Check if weight is bold or heavier
|
|
*/
|
|
public function isBold(): bool
|
|
{
|
|
return $this->value >= 700;
|
|
}
|
|
|
|
/**
|
|
* Convert to SVG attribute value
|
|
*/
|
|
public function toSvgValue(): string
|
|
{
|
|
return (string) $this->value;
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->getNamedWeight() ?? $this->toSvgValue();
|
|
}
|
|
}
|