ImportMandate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 23
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 15 2
1
<?php
2
3
namespace GoCardlessPayment\Console\Commands;
4
5
use GoCardlessPayment\Actions\Imports\ImportMandateAction;
6
use Illuminate\Console\Command;
7
8
class ImportMandate extends Command
9
{
10
    protected $signature = 'gocardless-payment:import:mandate
11
    {id : Mandate id}
12
    ';
13
14
    protected $description = 'Import mandate to local storage by id';
15
16 3
    public function handle()
17
    {
18 3
        $mandateId = $this->argument('id');
19
20
        try {
21 3
            $model = ImportMandateAction::make($mandateId)->execute();
22 1
        } catch (\Exception $e) {
23 1
            $this->error("Mandate not imported. [{$e->getMessage()}]");
24
25 1
            return static::FAILURE;
26
        }
27
28 2
        $this->info("Imported mandate [{$model->getKey()}] for customer [{$model->customer_id}].");
0 ignored issues
show
Bug introduced by
The property customer_id does not seem to exist on GoCardlessPayment\Models\GoCardlessMandate. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
29
30 2
        return static::SUCCESS;
31
    }
32
}
33