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>
28 lines
791 B
PHP
28 lines
791 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Services\Micropub\Handlers\CardHandler;
|
|
use App\Services\Micropub\Handlers\EntryHandler;
|
|
use App\Services\Micropub\Handlers\UpdateHandler;
|
|
use App\Services\Micropub\MicropubHandlerRegistry;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class MicropubServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(MicropubHandlerRegistry::class, function () {
|
|
$registry = new MicropubHandlerRegistry;
|
|
|
|
// Register handlers
|
|
$registry->register('card', new CardHandler);
|
|
$registry->register('entry', new EntryHandler);
|
|
$registry->register('update', new UpdateHandler);
|
|
|
|
return $registry;
|
|
});
|
|
}
|
|
}
|