- 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.
83 lines
1.7 KiB
PHP
83 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\Svg\ValueObjects\Geometry;
|
|
|
|
use App\Framework\Exception\ErrorCode;
|
|
use App\Framework\Exception\FrameworkException;
|
|
|
|
/**
|
|
* Value Object representing a radius value for circles and rounded corners
|
|
*/
|
|
final readonly class Radius
|
|
{
|
|
public function __construct(
|
|
public float $value
|
|
) {
|
|
if ($value < 0) {
|
|
throw FrameworkException::create(
|
|
ErrorCode::VAL_INVALID_FORMAT,
|
|
'Radius cannot be negative'
|
|
)->withData(['value' => $value]);
|
|
}
|
|
}
|
|
|
|
public static function zero(): self
|
|
{
|
|
return new self(0.0);
|
|
}
|
|
|
|
/**
|
|
* Get diameter (2 * radius)
|
|
*/
|
|
public function getDiameter(): float
|
|
{
|
|
return $this->value * 2;
|
|
}
|
|
|
|
/**
|
|
* Get circumference (2 * π * radius)
|
|
*/
|
|
public function getCircumference(): float
|
|
{
|
|
return 2 * M_PI * $this->value;
|
|
}
|
|
|
|
/**
|
|
* Get area (π * radius²)
|
|
*/
|
|
public function getArea(): float
|
|
{
|
|
return M_PI * $this->value * $this->value;
|
|
}
|
|
|
|
/**
|
|
* Scale radius by factor
|
|
*/
|
|
public function scale(float $factor): self
|
|
{
|
|
if ($factor < 0) {
|
|
throw FrameworkException::create(
|
|
ErrorCode::VAL_INVALID_FORMAT,
|
|
'Scale factor cannot be negative'
|
|
)->withData(['factor' => $factor]);
|
|
}
|
|
|
|
return new self($this->value * $factor);
|
|
}
|
|
|
|
/**
|
|
* Convert to SVG attribute value
|
|
*/
|
|
public function toSvgValue(): string
|
|
{
|
|
return sprintf('%.2f', $this->value);
|
|
}
|
|
|
|
public function __toString(): string
|
|
{
|
|
return $this->toSvgValue();
|
|
}
|
|
}
|