ContactsPullCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 23
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 11 2
1
<?php
2
3
namespace IproSync\Console\Commands;
4
5
use Illuminate\Console\Command;
6
use IproSync\Console\Commands\Traits\HasRequestParams;
7
use IproSync\Jobs\Contacts\ContactPull;
8
use IproSync\Jobs\Contacts\ContactsPull;
9
10
class ContactsPullCommand extends Command
11
{
12
    use HasRequestParams;
13
14
    protected $signature = 'iprosoftware-sync:contacts:pull
15
     {--id= : Pull contact by ipro id.}
16
     {--request_params= : Send query params (url encoded).}
17
     {--queue= : Queue to dispatch job.}
18
    ';
19
20
    protected $description = 'Pull ipro contacts';
21
22
    public function handle(): int
23
    {
24
        if ($id = $this->option('id')) {
25
            ContactPull::dispatch($id, $this->getRequestParams())
26
                ->onQueue($this->option('queue'));
27
        } else {
28
            ContactsPull::dispatch(null, $this->getRequestParams())
29
                ->onQueue($this->option('queue'));
30
        }
31
32
        return 0;
33
    }
34
}
35