30 lines
708 B
PHP
30 lines
708 B
PHP
<?php
|
|
/**
|
|
* This service file is part of item.
|
|
*
|
|
* @author ctexthuang
|
|
* @contact ctexthuang@qq.com
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Service\Admin\Catering\Print;
|
|
|
|
use App\Constants\Admin\CateringCode;
|
|
use App\Exception\ErrException;
|
|
|
|
class PrintOrderFactory
|
|
{
|
|
/**
|
|
* @param $type
|
|
* @return JdPrintService|YlyPrintService
|
|
*/
|
|
public function handle($type): YlyPrintService|JdPrintService
|
|
{
|
|
return match ($type) {
|
|
CateringCode::OPTION_PRINT_YLY => new YlyPrintService(),
|
|
CateringCode::OPTION_PRINT_CODING => new JdPrintService(),
|
|
default => throw new ErrException('Order printing class does not exist'),
|
|
};
|
|
}
|
|
} |