Introduce typed DTOs and sub-namespaces for Micropub handlers
Each handler now declares the data class it needs via dataClass(). The controller builds the appropriate typed DTO from the raw request array before calling handle(), giving handlers typed property access instead of raw array lookups. Handlers moved to App\Services\Micropub\Handlers, data objects to App\Services\Micropub\Data. MicropubHandlerRegistry and the interface are documented with flow diagrams and guidance for adding new types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
24cb6d61aa
commit
ad15b36f4d
12 changed files with 282 additions and 36 deletions
|
|
@ -45,7 +45,9 @@ class MicropubController extends Controller
|
|||
|
||||
try {
|
||||
$handler = $this->handlerRegistry->getHandler($type);
|
||||
$result = $handler->handle($request->getMicropubData());
|
||||
$dataClass = $handler->dataClass();
|
||||
$data = $dataClass::fromArray($request->getMicropubData());
|
||||
$result = $handler->handle($data);
|
||||
|
||||
if ($result['response'] === 'updated') {
|
||||
return response()->json([
|
||||
|
|
|
|||
Loading…
Reference in a new issue