| Total Complexity | 4 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | class GenerateTask extends Command |
||
| 10 | { |
||
| 11 | protected $signature = 'task:make {id}'; |
||
| 12 | |||
| 13 | protected $description = 'Generate Task by Solution Id'; |
||
| 14 | |||
| 15 | public function handle() |
||
| 16 | { |
||
| 17 | $id = $this->argument('id'); |
||
| 18 | app()->singleton(SolutionServer::class, function () { |
||
| 19 | return new SolutionServer(); |
||
| 20 | }); |
||
| 21 | if (strpos($id, '-') !== false) { |
||
|
|
|||
| 22 | list($start, $end) = explode('-', $id, 2); |
||
| 23 | $start = intval($start); |
||
| 24 | $end = intval($end); |
||
| 25 | for ($i = $start; $i <= $end; $i++) { |
||
| 26 | $this->addTask($i); |
||
| 27 | } |
||
| 28 | } else { |
||
| 29 | $this->addTask($id); |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 | private function addTask($id) |
||
| 37 | } |
||
| 38 | } |
||
| 39 |