chore: complete update

This commit is contained in:
2025-07-17 16:24:20 +02:00
parent 899227b0a4
commit 64a7051137
1300 changed files with 85570 additions and 2756 deletions

View File

@@ -0,0 +1,73 @@
<?php
declare(strict_types=1);
namespace App\Framework\Exception;
class FrameworkException extends \RuntimeException
{
protected ExceptionContext $context;
public function __construct(
string $message,
int $code = 0,
?\Throwable $previous = null,
?ExceptionContext $context = null
) {
parent::__construct($message, $code, $previous);
$this->context = $context ?? ExceptionContext::empty();
}
public function getContext(): ExceptionContext
{
return $this->context;
}
public function withContext(ExceptionContext $context): self
{
$new = clone $this;
$new->context = $context;
return $new;
}
public function withOperation(string $operation, ?string $component = null): self
{
return $this->withContext(
$this->context->withOperation($operation, $component)
);
}
public function withData(array $data): self
{
return $this->withContext(
$this->context->withData($data)
);
}
public function withDebug(array $debug): self
{
return $this->withContext(
$this->context->withDebug($debug)
);
}
public function withMetadata(array $metadata): self
{
return $this->withContext(
$this->context->withMetadata($metadata)
);
}
public function toArray(): array
{
return [
'class' => static::class,
'message' => $this->getMessage(),
'code' => $this->getCode(),
'file' => $this->getFile(),
'line' => $this->getLine(),
'context' => $this->context->toArray(),
'trace' => $this->getTraceAsString(),
];
}
}