ExaminationStudentMigrate::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
cc 2
eloc 11
nc 2
nop 0
dl 0
loc 14
rs 9.9
c 2
b 0
f 2
1
<?php
2
3
namespace App\Console\Commands;
4
5
use App\Models\Security_user;
6
use Illuminate\Console\Command;
7
use App\Http\Controllers\ExaminationStudentsController;
8
9
class ExaminationStudentMigrate extends Command
10
{
11
    /**
12
     * The name and signature of the console command.
13
     *
14
     * @var string
15
     */
16
    protected $signature = 'examination:migrate {year} {grade} {offset} {limit} {mode}';
17
18
    /**
19
     * This will migrate set of examination student's from DoE to SIS.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'This command designed to map and produce new students id for examination';
24
25
    /**
26
     * Create a new command instance.
27
     *
28
     * @return void
29
     */
30
    public function __construct()
31
    {
32
        parent::__construct();
33
    }
34
35
    /**
36
     * Execute the console command.
37
     *
38
     * @return mixed
39
     */
40
    public function handle()
41
    {
42
        $output = new \Symfony\Component\Console\Output\ConsoleOutput();
43
        $output->writeln('###########################################------Inserting file records------###########################################');
44
        $this->examinationController = new ExaminationStudentsController($this->argument('year'), $this->argument('grade'));
0 ignored issues
show
Bug Best Practice introduced by
The property examinationController does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
45
        if ($this->argument('mode') == 'export') {
46
            $output->writeln('###########################################------starting export------###########################################');
47
            $this->examinationController->export();
48
            $output->writeln('###########################################------Finished inserting file records------###########################################');
49
        } else {
50
            $this->examinationController->doMatch($this->argument('offset'), $this->argument('limit'), $this->argument(('mode')));
51
            $this->examinationController->export();
52
        }
53
        $output->writeln('###########################################------Finished inserting file records------###########################################');
54
    }
55
}
56