RegisterC2BUrls::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Starnerz\LaravelDaraja\Commands;
4
5
use Illuminate\Console\Command;
6
use Starnerz\LaravelDaraja\Facades\MpesaApi;
7
8
class RegisterC2BUrls extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'daraja:register-urls';
16
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Registers C2B URLs to the Safaricom C2B API';
23
24
    /**
25
     * Create a new command instance.
26
     */
27
    public function __construct()
28
    {
29
        parent::__construct();
30
    }
31
32
    /**
33
     * Execute the console command.
34
     *
35
     * @return mixed
36
     */
37
    public function handle()
38
    {
39
        $confirmation = config('mpesaapi.c2b_url.confirmation');
40
        $validation = config('mpesaapi.c2b_url.validation');
41
42
        MpesaAPI::c2b()->registerUrls($confirmation, $validation);
0 ignored issues
show
Bug introduced by
The method c2b() does not exist on Starnerz\LaravelDaraja\Facades\MpesaApi. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

42
        MpesaAPI::/** @scrutinizer ignore-call */ 
43
                  c2b()->registerUrls($confirmation, $validation);
Loading history...
43
        $this->info('URLs registered successfully');
44
    }
45
}
46