| Conditions | 4 |
| Paths | 8 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 44 | public function handle() |
||
| 45 | { |
||
| 46 | $id = $this->argument('id') ? $this->argument('id') : $this->askForArticles(); |
||
| 47 | $article = Article::findOrFail($id); |
||
| 48 | $user = User::findOrFail($article->user_id); |
||
| 49 | |||
| 50 | try { |
||
| 51 | $headers = ['Key', 'Value']; |
||
| 52 | |||
| 53 | $fields = [ |
||
| 54 | ['Title:', $article->title], |
||
| 55 | ['Description', $article->description], |
||
| 56 | ['Read:', $article->read ? 'Yes' : 'No'], |
||
| 57 | ['User id:', $article->user_id], |
||
| 58 | ['User name:', $user->name], |
||
| 59 | ]; |
||
| 60 | |||
| 61 | $this->table($headers, $fields); |
||
| 62 | } catch (Exception $e) { |
||
| 63 | $this->error('Error'); |
||
| 64 | } |
||
| 65 | } |
||
| 66 | } |
||
| 67 |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.