1 | <?php |
||
2 | |||
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
3 | namespace BristolSU\Service\Typeform\Http\Controllers; |
||
4 | |||
5 | use BristolSU\Service\Typeform\Models\TypeformAuthCode; |
||
6 | use BristolSU\Support\User\Contracts\UserAuthentication; |
||
7 | use Carbon\Carbon; |
||
8 | use GuzzleHttp\Client; |
||
9 | use Illuminate\Http\Request; |
||
10 | |||
11 | class OAuthRedirectController |
||
0 ignored issues
–
show
|
|||
12 | { |
||
13 | |||
14 | 3 | public function index(Request $request, Client $client) |
|
0 ignored issues
–
show
|
|||
15 | { |
||
16 | 3 | $response = $client->post(config('typeform_service.urlAccessToken'), [ |
|
0 ignored issues
–
show
|
|||
17 | 'form_params' => [ |
||
18 | 3 | 'grant_type' => 'authorization_code', |
|
19 | 3 | 'code' => $request->input('code'), |
|
20 | 3 | 'client_id' => config('typeform_service.client_id'), |
|
21 | 3 | 'client_secret' => config('typeform_service.client_secret'), |
|
22 | 3 | 'redirect_uri' => config('app.url') . '/_connector/typeform/redirect' |
|
23 | ], |
||
24 | ]); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
25 | 3 | $token = json_decode($response->getBody()->getContents(), true); |
|
26 | 3 | $authCode = new TypeformAuthCode; |
|
27 | 3 | $authCode->auth_code = $token['access_token']; |
|
28 | 3 | $authCode->refresh_token = $token['refresh_token']; |
|
29 | 3 | $authCode->expires_at = Carbon::now()->addSeconds($token['expires_in']); |
|
30 | 3 | $authCode->user_id = app(UserAuthentication::class)->getUser()->controlId(); |
|
31 | 3 | $authCode->save(); |
|
32 | |||
33 | 3 | return view('typeformservice::close_window'); |
|
34 | } |
||
35 | |||
36 | } |