Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Apr 12, 2017
1 parent 00d9d35 commit a73aede
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/Illuminate/Queue/Console/WorkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,28 +149,29 @@ protected function writeOutput(Job $job, $status)
{
switch ($status) {
case 'starting':
$this->writeStatus($job, 'Processing', 'comment');
break;
return $this->writeStatus($job, 'Processing', 'comment');
case 'success':
$this->writeStatus($job, 'Processed', 'info');
break;
return $this->writeStatus($job, 'Processed', 'info');
case 'failed':
$this->writeStatus($job, 'Failed', 'error');
break;
return $this->writeStatus($job, 'Failed', 'error');
}
}

/**
* Format the status output for the queue worker.
*
* @param \Illuminate\Contracts\Queue\Job $job
* @param string $status
* @param string $colorStyle
* @param string $status
* @param string $type
* @return void
*/
protected function writeStatus(Job $job, $status, $colorStyle)
protected function writeStatus(Job $job, $status, $type)
{
$this->output->writeln(sprintf("<$colorStyle>[%s] %s</$colorStyle> %s", Carbon::now()->format('Y-m-d H:i:s'), str_pad("$status:", 11), $job->resolveName()));
$this->output->writeln(sprintf(
"<{$type}>[%s] %s</{$type}> %s",
Carbon::now()->format('Y-m-d H:i:s'),
str_pad("{$status}:", 11), $job->resolveName()
));
}

/**
Expand Down

0 comments on commit a73aede

Please sign in to comment.