Total Complexity | 6 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
6 | class RestoreUserCommand extends UserCommand |
||
7 | { |
||
8 | /** |
||
9 | * The name and signature of the console command. |
||
10 | * |
||
11 | * @var string |
||
12 | */ |
||
13 | protected $signature = 'user:restore |
||
14 | {value : Get user for a value (by email, id)} |
||
15 | {field? : Field to search by}'; |
||
16 | |||
17 | /** |
||
18 | * The console command description. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $description = 'Restore a user'; |
||
23 | |||
24 | /** |
||
25 | * Execute the console command. |
||
26 | */ |
||
27 | public function handle() |
||
28 | { |
||
29 | $user = $this->getUserModel(); |
||
30 | |||
31 | if (is_null($user)) { |
||
32 | $this->error('Oops, the user was not found!'); |
||
33 | return 1; |
||
34 | } |
||
35 | |||
36 | if (!method_exists($user, 'restore')) { |
||
37 | $this->error('Oops, user does not use softdelete!'); |
||
38 | return 1; |
||
39 | } |
||
40 | |||
41 | $user->restore(); |
||
42 | |||
43 | $this->info('User restored successfully!'); |
||
44 | |||
45 | return 0; |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Get user model |
||
50 | * |
||
51 | * @return \Illuminate\Database\Eloquent\Model|null |
||
52 | */ |
||
53 | protected function getUserModel() |
||
67 | } |
||
68 | } |
||
69 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.