Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
16.67% covered (danger)
16.67%
1 / 6
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
IfexQuotationsSync
16.67% covered (danger)
16.67%
1 / 6
50.00% covered (danger)
50.00%
1 / 2
8.21
0.00% covered (danger)
0.00%
0 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 handle
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace App\Console\Commands;
4
5use App\Http\Controllers\IfexController;
6use Illuminate\Console\Command;
7use Illuminate\Support\Facades\Log;
8
9class IfexQuotationsSync extends Command
10{
11    /**
12     * The name and signature of the console command.
13     *
14     * @var string
15     */
16    protected $signature = 'ifex-quotations:sync';
17
18    /**
19     * The console command description.
20     *
21     * @var string
22     */
23    protected $description = 'Synchronizes IFEX budgets';
24
25    /**
26     * Create a new command instance.
27     */
28    public function __construct(protected IfexController $ifexController)
29    {
30        parent::__construct();
31    }
32
33    /**
34     * Execute the console command.
35     */
36    public function handle(): int
37    {
38        try {
39            $this->ifexController->syncQuotations();
40
41            return Command::SUCCESS;
42        } catch (\Exception $e) {
43            Log::channel('g3w')->error('Synchronization failed for ifex update, Error: '.$e->getMessage());
44
45            return Command::FAILURE;
46        }
47    }
48}