Skip to content

Commit d5b0417

Browse files
committed
Merge branch 'develop'
2 parents b510ead + 8e72e5b commit d5b0417

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

Console/Commands/ListCommand.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
use Codefy\Framework\Application;
88
use Codefy\Framework\Console\ConsoleCommand;
99
use Codefy\Framework\Scheduler\Schedule;
10+
use Cron\CronExpression;
11+
use Exception;
1012
use Symfony\Component\Console\Helper\Table;
1113

1214
class ListCommand extends ConsoleCommand
@@ -22,6 +24,9 @@ public function __construct(protected Schedule $schedule, protected Application
2224
parent::__construct(codefy: $codefy);
2325
}
2426

27+
/**
28+
* @throws Exception
29+
*/
2530
public function handle(): int
2631
{
2732
$table = new Table($this->output);
@@ -35,10 +40,12 @@ public function handle(): int
3540
$jobs = $this->schedule->allProcessors();
3641

3742
foreach ($jobs as $job) {
43+
$nextRun = new CronExpression($job->getExpression());
44+
3845
$table->addRow([
3946
get_class($job),
40-
$job->getExpression(),
41-
$job->getExpression()->getNextRunDate(),
47+
$nextRun->getExpression(),
48+
$nextRun->getNextRunDate()->format(format: 'd F Y h:i A'),
4249
$job->canRunOnlyOneInstance() ? 'yes' : 'no',
4350
]);
4451
}

Console/Commands/ServeCommand.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ class ServeCommand extends ConsoleCommand
1414

1515
protected array $options = [
1616
[
17-
'--php',
18-
'-pp',
17+
'php',
18+
null,
1919
'optional',
2020
'The PHP binary [default: "PHP_BINARY"].',
2121
false
2222
],
2323
[
24-
'--host',
25-
'-h',
24+
'host',
25+
null,
2626
'optional',
2727
'Server HTTP host [default: "localhost"].',
2828
false
2929
],
3030
[
31-
'--port',
32-
'-pt',
31+
'port',
32+
null,
3333
'optional',
3434
'The HTTP host port [default: "8080"].',
3535
false
@@ -52,9 +52,9 @@ protected function configure(): void
5252

5353
public function handle(): int
5454
{
55-
$php = escapeshellarg($this->getOptions(key: 'php') ?? PHP_BINARY);
56-
$host = $this->getOptions(key: 'host') ?? 'localhost';
57-
$port = $this->getOptions(key: 'port') ?? '8080';
55+
$php = escapeshellarg(empty($this->getOptions(key: 'php')) ? PHP_BINARY : $this->getOptions(key: 'php'));
56+
$host = empty($this->getOptions(key: 'host')) ? 'localhost' : $this->getOptions(key: 'host');
57+
$port = empty($this->getOptions(key: 'port')) ? '8080' : $this->getOptions(key: 'port');
5858

5959
$this->terminalComment(string: sprintf('CodefyPHP development server started on http://%s:%s', $host, $port));
6060
$this->terminalComment(string: 'Press control-C to stop.');

0 commit comments

Comments
 (0)