Completed
Push — master ( 8c4be0...39f1f0 )
by Orkhan
01:13
created

SuccessfulPaymentController   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 12
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 1
1
<?php
2
3
namespace Orkhanahmadov\LaravelGoldenpay\Http\Controllers;
4
5
use Illuminate\Http\Request;
6
use Orkhanahmadov\LaravelGoldenpay\Events\PaymentReceivedEvent;
7
8
class SuccessfulPaymentController extends Controller
9
{
10
    /**
11
     * @param Request $request
12
     */
13
    public function __invoke(Request $request)
14
    {
15
        $payment = $this->goldenpay->paymentResult($request->query('payment_key'));
0 ignored issues
show
Bug introduced by
It seems like $request->query('payment_key') targeting Illuminate\Http\Concerns...ractsWithInput::query() can also be of type array or null; however, Orkhanahmadov\LaravelGol...denpay::paymentResult() does only seem to accept object<Orkhanahmadov\Lar...\Models\Payment>|string, maybe add an additional type check?

This check looks at variables that are passed out again to other methods.

If the outgoing method call has stricter type requirements than the method itself, an issue is raised.

An additional type check may prevent trouble.

Loading history...
16
17
        $this->dispatcher->dispatch(new PaymentReceivedEvent($payment));
18
    }
19
}
20