| 12345678910111213141516171819202122 |
- <?php
- declare(strict_types=1);
- namespace app\miniapi\service\driver;
- use app\miniapi\exception\ApiException;
- final class TaskActionFactory
- {
- public static function make(string $action): TaskAction
- {
- return match ($action) {
- 'start' => new StartDelivery(),
- 'checkin' => new CheckIn(),
- 'exception' => new ReportException(),
- 'draft' => new SaveFulfillment(false),
- 'complete' => new SaveFulfillment(true),
- default => throw new ApiException(40401, '操作不存在', 404),
- };
- }
- }
|