mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-12 02:08:40 +00:00
20 lines
478 B
PHP
20 lines
478 B
PHP
<?php
|
|
|
|
namespace phpOMS\Utils\TaskSchedule;
|
|
|
|
use phpOMS\System\OperatingSystem;
|
|
use phpOMS\System\SystemType;
|
|
|
|
final class TaskFactory {
|
|
public static function create(Interval $interval = null, string $cmd = '') : TaskInterface
|
|
{
|
|
switch(OperatingSystem::getSystem()) {
|
|
case SystemType::WIN:
|
|
return new Schedule($interval, $cmd);
|
|
case SystemType::LINUX:
|
|
return new CronJob($interval, $cmd);
|
|
default:
|
|
throw new \Exception('Unsupported system.');
|
|
}
|
|
}
|
|
} |