Passed
Push — master ( 34ea0b...07bc23 )
by Dominic
02:47
created
src/Interfaces/Buildable.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,20 +4,20 @@
 block discarded – undo
4 4
 
5 5
 interface Buildable
6 6
 {
7
-    /**
8
-     * Create a resource
9
-     *
10
-     * @param array $json The request body
11
-     * @return array The response body
12
-     * @throws \tbclla\Revolut\Exceptions\ApiException if the client responded with a 4xx-5xx response
13
-     * @throws \tbclla\Revolut\Exceptions\AppUnauthorizedException if the app needs to be re-authorized
14
-     */
15
-    public function create(array $json);
7
+	/**
8
+	 * Create a resource
9
+	 *
10
+	 * @param array $json The request body
11
+	 * @return array The response body
12
+	 * @throws \tbclla\Revolut\Exceptions\ApiException if the client responded with a 4xx-5xx response
13
+	 * @throws \tbclla\Revolut\Exceptions\AppUnauthorizedException if the app needs to be re-authorized
14
+	 */
15
+	public function create(array $json);
16 16
 
17
-    /**
18
-     * Get a buildable instance
19
-     *
20
-     * @return \tbclla\Revolut\Builders\Builder
21
-     */
22
-    public function build();
17
+	/**
18
+	 * Get a buildable instance
19
+	 *
20
+	 * @return \tbclla\Revolut\Builders\Builder
21
+	 */
22
+	public function build();
23 23
 }
Please login to merge, or discard this patch.
src/Interfaces/GrantsAccessTokens.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -4,24 +4,24 @@
 block discarded – undo
4 4
 
5 5
 interface GrantsAccessTokens
6 6
 {
7
-    /**
8
-     * Get the token value
9
-     *
10
-     * @return string
11
-     */
12
-    public function getValue();
7
+	/**
8
+	 * Get the token value
9
+	 *
10
+	 * @return string
11
+	 */
12
+	public function getValue();
13 13
 
14
-    /**
15
-     * Get the token type
16
-     *
17
-     * @return string
18
-     */
19
-    public static function getType();
14
+	/**
15
+	 * Get the token type
16
+	 *
17
+	 * @return string
18
+	 */
19
+	public static function getType();
20 20
 
21
-    /**
22
-     * Get the grant type of the token
23
-     * 
24
-     * @return string
25
-     */
26
-    public static function getGrantType();
21
+	/**
22
+	 * Get the grant type of the token
23
+	 * 
24
+	 * @return string
25
+	 */
26
+	public static function getGrantType();
27 27
 }
Please login to merge, or discard this patch.
src/Interfaces/TokenRepository.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -4,33 +4,33 @@
 block discarded – undo
4 4
 
5 5
 interface TokenRepository
6 6
 {
7
-    /**
8
-     * Get the latest active access token
9
-     *
10
-     * @return \tbclla\Revolut\Auth\AccessToken|null
11
-     */
12
-    public function getAccessToken();
7
+	/**
8
+	 * Get the latest active access token
9
+	 *
10
+	 * @return \tbclla\Revolut\Auth\AccessToken|null
11
+	 */
12
+	public function getAccessToken();
13 13
 
14
-    /**
15
-     * Get the latest refresh token
16
-     *
17
-     * @return \tbclla\Revolut\Auth\RefreshToken|null
18
-     */
19
-    public function getRefreshToken();
14
+	/**
15
+	 * Get the latest refresh token
16
+	 *
17
+	 * @return \tbclla\Revolut\Auth\RefreshToken|null
18
+	 */
19
+	public function getRefreshToken();
20 20
 
21
-    /**
22
-     * Create a new access token
23
-     *
24
-     * @param string $value
25
-     * @return \tbclla\Revolut\Auth\AccessToken
26
-     */
27
-    public function createAccessToken(string $value);
21
+	/**
22
+	 * Create a new access token
23
+	 *
24
+	 * @param string $value
25
+	 * @return \tbclla\Revolut\Auth\AccessToken
26
+	 */
27
+	public function createAccessToken(string $value);
28 28
 
29
-    /**
30
-     * Create a new refresh token
31
-     *
32
-     * @param string $value
33
-     * @return \tbclla\Revolut\Auth\RefreshToken
34
-     */
35
-    public function createRefreshToken(string $value);
29
+	/**
30
+	 * Create a new refresh token
31
+	 *
32
+	 * @param string $value
33
+	 * @return \tbclla\Revolut\Auth\RefreshToken
34
+	 */
35
+	public function createRefreshToken(string $value);
36 36
 }
Please login to merge, or discard this patch.
src/Controllers/AuthorizationController.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -10,49 +10,49 @@
 block discarded – undo
10 10
 
11 11
 class AuthorizationController extends Controller
12 12
 {
13
-    /**
14
-     * @param \illuminate\Http\Request $request
15
-     * @param \tbclla\Revolut\Auth\Requests\AuthorizationCodeRequest $authRequest
16
-     * @return \illuminate\Http\RedirectResponse
17
-     */
18
-    public function create(Request $request, AuthorizationCodeRequest $authRequest)
19
-    {
20
-        // store the state and an optional redirect url
21
-        session()->put($authRequest->state, [
22
-            'redirect_uri' => $request->after_success
23
-        ]);
24
-
25
-        // redirect to Revolut's OAuth flow
26
-        return redirect($authRequest->build());
27
-    }
28
-
29
-    /**
30
-     * @param \illuminate\Http\Request $request
31
-     * @param \tbclla\Revolut\Auth\TokenManager $tokenManager
32
-     * @return mixed
33
-     */
34
-    public function store(Request $request, TokenManager $tokenManager)
35
-    {
36
-        // verify that the request contains the required parameters
37
-        if (!$request->state or !$request->code) {
38
-            abort(405, 'Invalid Request');
39
-        }
40
-
41
-        // verify that the session holds a matching state
42
-        if (!session()->has($request->state)) {
43
-            abort(405, 'Invalid State');
44
-        }
45
-
46
-        $authCode = new AuthorizationCode($request->code);
13
+	/**
14
+	 * @param \illuminate\Http\Request $request
15
+	 * @param \tbclla\Revolut\Auth\Requests\AuthorizationCodeRequest $authRequest
16
+	 * @return \illuminate\Http\RedirectResponse
17
+	 */
18
+	public function create(Request $request, AuthorizationCodeRequest $authRequest)
19
+	{
20
+		// store the state and an optional redirect url
21
+		session()->put($authRequest->state, [
22
+			'redirect_uri' => $request->after_success
23
+		]);
24
+
25
+		// redirect to Revolut's OAuth flow
26
+		return redirect($authRequest->build());
27
+	}
28
+
29
+	/**
30
+	 * @param \illuminate\Http\Request $request
31
+	 * @param \tbclla\Revolut\Auth\TokenManager $tokenManager
32
+	 * @return mixed
33
+	 */
34
+	public function store(Request $request, TokenManager $tokenManager)
35
+	{
36
+		// verify that the request contains the required parameters
37
+		if (!$request->state or !$request->code) {
38
+			abort(405, 'Invalid Request');
39
+		}
40
+
41
+		// verify that the session holds a matching state
42
+		if (!session()->has($request->state)) {
43
+			abort(405, 'Invalid State');
44
+		}
45
+
46
+		$authCode = new AuthorizationCode($request->code);
47 47
         
48
-        $tokenManager->requestAccessToken($authCode);
48
+		$tokenManager->requestAccessToken($authCode);
49 49
 
50
-        $state = session()->pull($request->state);
50
+		$state = session()->pull($request->state);
51 51
         
52
-        $redirect = $state['redirect_uri'];
52
+		$redirect = $state['redirect_uri'];
53 53
         
54
-        return $redirect
55
-            ? redirect($redirect)
56
-            : response('Authorization successful', 200);
57
-    }
54
+		return $redirect
55
+			? redirect($redirect)
56
+			: response('Authorization successful', 200);
57
+	}
58 58
 }
Please login to merge, or discard this patch.