23 lines
459 B
PHP
23 lines
459 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Support\VideoWorkflow\StepHandlers;
|
||
|
|
|
||
|
|
class StepHandlerManager
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @param array<StepHandler> $handlers
|
||
|
|
*/
|
||
|
|
public function __construct(private readonly array $handlers) {}
|
||
|
|
|
||
|
|
public function resolve(string $type): ?StepHandler
|
||
|
|
{
|
||
|
|
foreach ($this->handlers as $handler) {
|
||
|
|
if ($handler->type() === $type) {
|
||
|
|
return $handler;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
}
|