1 | <?php |
||
2 | |||
3 | namespace App\Console\Commands; |
||
4 | |||
5 | use App\Models\Academic_period; |
||
6 | use Illuminate\Console\Command; |
||
7 | use App\Models\Institution_shift; |
||
8 | use App\Http\Controllers\CloneController; |
||
9 | |||
10 | class cleanConfig extends Command |
||
11 | { |
||
12 | /** |
||
13 | * The name and signature of the console command. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $signature = 'clean:clone {year}'; |
||
18 | |||
19 | /** |
||
20 | * The console command description. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $description = 'Command description'; |
||
25 | |||
26 | /** |
||
27 | * Create a new command instance. |
||
28 | * |
||
29 | * @return void |
||
30 | */ |
||
31 | public function __construct() |
||
32 | { |
||
33 | parent::__construct(); |
||
34 | $this->shifts = new Institution_shift(); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
35 | $this->academic_period = new Academic_period(); |
||
0 ignored issues
–
show
|
|||
36 | $this->clone = new CloneController(); |
||
0 ignored issues
–
show
|
|||
37 | $this->output = new \Symfony\Component\Console\Output\ConsoleOutput(); |
||
0 ignored issues
–
show
It seems like
new Symfony\Component\Co...\Output\ConsoleOutput() of type Symfony\Component\Console\Output\ConsoleOutput is incompatible with the declared type Illuminate\Console\OutputStyle of property $output .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Execute the console command. |
||
42 | * |
||
43 | * @return mixed |
||
44 | */ |
||
45 | public function handle() |
||
46 | { |
||
47 | $this->start_time = microtime(TRUE); |
||
0 ignored issues
–
show
|
|||
48 | $year = $this->argument('year'); |
||
49 | $academicPeriod = $this->academic_period->getAcademicPeriod($year); |
||
50 | $previousAcademicPeriodYear = $academicPeriod->order; |
||
0 ignored issues
–
show
|
|||
51 | $previousAcademicPeriod = Academic_period::where('order',$previousAcademicPeriodYear+1)->first(); |
||
52 | |||
53 | $params = [ |
||
54 | 'academic_period' => $academicPeriod, |
||
55 | 'previous_academic_period' => $previousAcademicPeriod |
||
56 | ]; |
||
57 | |||
58 | if($year == '2019' || $year == '2018/19'){ |
||
59 | die('Academic Year 2019 or earlier can`t be deleted'); |
||
0 ignored issues
–
show
|
|||
60 | }else{ |
||
61 | $this->clone->cleanConfig($params); |
||
62 | } |
||
63 | } |
||
64 | } |
||
65 |