Code Duplication    Length = 38-38 lines in 4 locations

app/Console/ProjectDailyColumnStatsExportCommand.php 1 location

@@ 22-59 (lines=38) @@
19
/**
20
 * project daily column stats export command class.
21
 */
22
class ProjectDailyColumnStatsExportCommand extends BaseCommand
23
{
24
    /**
25
     * Configure the console command.
26
     *
27
     * @return void
28
     */
29
    protected function configure()
30
    {
31
        $this
32
            ->setName('export:daily-project-column-stats')
33
            ->setDescription('Daily project column stats CSV export (number of tasks per column and per day)')
34
            ->addArgument('project_id', InputArgument::REQUIRED, 'Project id')
35
            ->addArgument('start_date', InputArgument::REQUIRED, 'Start date (YYYY-MM-DD)')
36
            ->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)');
37
    }
38
39
    /**
40
     * Execute the console command.
41
     *
42
     * @param InputInterface  $output
43
     * @param OutputInterface $output
44
     *
45
     * @return void
46
     */
47
    protected function execute(InputInterface $input, OutputInterface $output)
48
    {
49
        $data = $this->projectDailyColumnStatsModel->getAggregatedMetrics(
50
            $input->getArgument('project_id'),
51
            $input->getArgument('start_date'),
52
            $input->getArgument('end_date')
53
        );
54
55
        if (is_array($data)) {
56
            Csv::output($data);
57
        }
58
    }
59
}
60

app/Console/SubtaskExportCommand.php 1 location

@@ 22-59 (lines=38) @@
19
/**
20
 * Subtask export command class.
21
 */
22
class SubtaskExportCommand extends BaseCommand
23
{
24
    /**
25
     * Configure the console command.
26
     *
27
     * @return void
28
     */
29
    protected function configure()
30
    {
31
        $this
32
            ->setName('export:subtasks')
33
            ->setDescription('Subtasks CSV export')
34
            ->addArgument('project_id', InputArgument::REQUIRED, 'Project id')
35
            ->addArgument('start_date', InputArgument::REQUIRED, 'Start date (YYYY-MM-DD)')
36
            ->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)');
37
    }
38
39
    /**
40
     * Execute the console command.
41
     *
42
     * @param InputInterface  $output
43
     * @param OutputInterface $output
44
     *
45
     * @return void
46
     */
47
    protected function execute(InputInterface $input, OutputInterface $output)
48
    {
49
        $data = $this->subtaskExport->export(
50
            $input->getArgument('project_id'),
51
            $input->getArgument('start_date'),
52
            $input->getArgument('end_date')
53
        );
54
55
        if (is_array($data)) {
56
            Csv::output($data);
57
        }
58
    }
59
}
60

app/Console/TaskExportCommand.php 1 location

@@ 22-59 (lines=38) @@
19
/**
20
 * Task export command class.
21
 */
22
class TaskExportCommand extends BaseCommand
23
{
24
    /**
25
     * Configure the console command.
26
     *
27
     * @return void
28
     */
29
    protected function configure()
30
    {
31
        $this
32
            ->setName('export:tasks')
33
            ->setDescription('Tasks CSV export')
34
            ->addArgument('project_id', InputArgument::REQUIRED, 'Project id')
35
            ->addArgument('start_date', InputArgument::REQUIRED, 'Start date (YYYY-MM-DD)')
36
            ->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)');
37
    }
38
39
    /**
40
     * Execute the console command.
41
     *
42
     * @param InputInterface  $output
43
     * @param OutputInterface $output
44
     *
45
     * @return void
46
     */
47
    protected function execute(InputInterface $input, OutputInterface $output)
48
    {
49
        $data = $this->taskExport->export(
50
            $input->getArgument('project_id'),
51
            $input->getArgument('start_date'),
52
            $input->getArgument('end_date')
53
        );
54
55
        if (is_array($data)) {
56
            Csv::output($data);
57
        }
58
    }
59
}
60

app/Console/TransitionExportCommand.php 1 location

@@ 22-59 (lines=38) @@
19
/**
20
 * Transition export command class.
21
 */
22
class TransitionExportCommand extends BaseCommand
23
{
24
    /**
25
     * Configure the console command.
26
     *
27
     * @return void
28
     */
29
    protected function configure()
30
    {
31
        $this
32
            ->setName('export:transitions')
33
            ->setDescription('Task transitions CSV export')
34
            ->addArgument('project_id', InputArgument::REQUIRED, 'Project id')
35
            ->addArgument('start_date', InputArgument::REQUIRED, 'Start date (YYYY-MM-DD)')
36
            ->addArgument('end_date', InputArgument::REQUIRED, 'End date (YYYY-MM-DD)');
37
    }
38
39
    /**
40
     * Execute the console command.
41
     *
42
     * @param InputInterface  $output
43
     * @param OutputInterface $output
44
     *
45
     * @return void
46
     */
47
    protected function execute(InputInterface $input, OutputInterface $output)
48
    {
49
        $data = $this->transitionExport->export(
50
            $input->getArgument('project_id'),
51
            $input->getArgument('start_date'),
52
            $input->getArgument('end_date')
53
        );
54
55
        if (is_array($data)) {
56
            Csv::output($data);
57
        }
58
    }
59
}
60