| Conditions | 3 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | public function createForCommand(string $command, array $args = [], ?string $scheduleName = null, ?string $scheduleCode = null): ScheduleInterface |
||
| 39 | { |
||
| 40 | /** @var ScheduleInterface $schedule */ |
||
| 41 | $schedule = $this->createNew(); |
||
| 42 | if (null === $scheduleName) { |
||
| 43 | $scheduleName = $command; |
||
| 44 | } |
||
| 45 | if (null === $scheduleCode) { |
||
| 46 | $scheduleCode = StringInflector::nameToCode( |
||
| 47 | \strtolower($scheduleName) |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | $schedule->setName($scheduleName); |
||
| 51 | $schedule->setCode($scheduleCode); |
||
| 52 | $schedule->setCommand($command); |
||
| 53 | $schedule->setArgs($args); |
||
| 54 | |||
| 55 | return $schedule; |
||
| 56 | } |
||
| 58 |