feat : catering
This commit is contained in:
30
app/Service/Admin/Print/PrintOrderFactory.php
Normal file
30
app/Service/Admin/Print/PrintOrderFactory.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* This service file is part of item.
|
||||
*
|
||||
* @author ctexthuang
|
||||
* @contact ctexthuang@qq.com
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service\Admin\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'),
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user