Unsubscribe   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 1
1
<?php
2
3
namespace App\Http\Controllers\Paypal;
4
5
use App\Http\Controllers\Controller;
6
use App\Models\PaypalSubscription as PaypalSub;
7
use Illuminate\Http\Request;
8
use leifermendez\paypal\PaypalSubscription;
9
10
class Unsubscribe extends Controller
11
{
12
    /**
13
     * Handle the incoming request.
14
     *
15
     * @return \Illuminate\Http\Response
16
     */
17
    public function __invoke(Request $request)
18
    {
19
        $pp = new PaypalSubscription();
20
        $response = $pp->cancelSubscription($request->paypal_subscription_id);
21
22
        PaypalSub::where('paypal_id', $request->paypal_subscription_id)
23
            ->update(['status' => 'CANCELLED']);
24
25
        return $response;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $response also could return the type string which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
26
    }
27
}
28