Passed
Push — master ( 5970f8...dab572 )
by Dominic
03:16
created
src/Traits/Encryptable.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -4,28 +4,28 @@
 block discarded – undo
4 4
 
5 5
 trait Encryptable
6 6
 {
7
-    /**
8
-     * Set the value attribute
9
-     *
10
-     * @param string $value
11
-     * @return void
12
-     */
13
-    public function setValueAttribute(string $value)
14
-    {
15
-        $encrypt = config('revolut.tokens.encrypt', true);
7
+	/**
8
+	 * Set the value attribute
9
+	 *
10
+	 * @param string $value
11
+	 * @return void
12
+	 */
13
+	public function setValueAttribute(string $value)
14
+	{
15
+		$encrypt = config('revolut.tokens.encrypt', true);
16 16
         
17
-        $this->attributes['value'] = $encrypt ? encrypt($value) : $value;
18
-        $this->attributes['is_encrypted'] = $encrypt;
19
-    }
17
+		$this->attributes['value'] = $encrypt ? encrypt($value) : $value;
18
+		$this->attributes['is_encrypted'] = $encrypt;
19
+	}
20 20
 
21
-    /**
22
-     * Get the value attribute.
23
-     * 
24
-     * @param string|null $value
25
-     * @return string
26
-     */
27
-    public function getValueAttribute($value)
28
-    {
29
-        return (string) $this->is_encrypted ? decrypt($value) : $value;
30
-    }
21
+	/**
22
+	 * Get the value attribute.
23
+	 * 
24
+	 * @param string|null $value
25
+	 * @return string
26
+	 */
27
+	public function getValueAttribute($value)
28
+	{
29
+		return (string) $this->is_encrypted ? decrypt($value) : $value;
30
+	}
31 31
 }
Please login to merge, or discard this patch.
src/Interfaces/PersistableToken.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@
 block discarded – undo
4 4
 
5 5
 interface PersistableToken
6 6
 {
7
-    /**
8
-     * Get the type of the token
9
-     *
10
-     * @return string
11
-     */
12
-    public static function getType();
7
+	/**
8
+	 * Get the type of the token
9
+	 *
10
+	 * @return string
11
+	 */
12
+	public static function getType();
13 13
 
14
-    /**
15
-     * Get the expiration date
16
-     *
17
-     * @return \Carbon\Carbon|null
18
-     */
19
-    public static function getExpiration();
14
+	/**
15
+	 * Get the expiration date
16
+	 *
17
+	 * @return \Carbon\Carbon|null
18
+	 */
19
+	public static function getExpiration();
20 20
 }
Please login to merge, or discard this patch.
src/Interfaces/MakesHttpRequests.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -4,33 +4,33 @@
 block discarded – undo
4 4
 
5 5
 interface MakesHttpRequests
6 6
 {
7
-    /**
8
-     * Make a 'POST' request
9
-     * 
10
-     * @param string $url The request url
11
-     * @param array $options The request options
12
-     * @return array The response body
13
-     * @throws \tbclla\Revolut\Exceptions\ApiException API returned a 4xx or 5xx response code
14
-     */
15
-    public function post(string $url, array $options = []);
7
+	/**
8
+	 * Make a 'POST' request
9
+	 * 
10
+	 * @param string $url The request url
11
+	 * @param array $options The request options
12
+	 * @return array The response body
13
+	 * @throws \tbclla\Revolut\Exceptions\ApiException API returned a 4xx or 5xx response code
14
+	 */
15
+	public function post(string $url, array $options = []);
16 16
 
17
-    /**
18
-     * Make a 'GET' request
19
-     * 
20
-     * @param string $url The request url
21
-     * @param array $options The request options
22
-     * @return array|null The response body
23
-     * @throws \tbclla\Revolut\Exceptions\ApiException API returned a 4xx or 5xx response code
24
-     */
25
-    public function get(string $url, array $options = []);
17
+	/**
18
+	 * Make a 'GET' request
19
+	 * 
20
+	 * @param string $url The request url
21
+	 * @param array $options The request options
22
+	 * @return array|null The response body
23
+	 * @throws \tbclla\Revolut\Exceptions\ApiException API returned a 4xx or 5xx response code
24
+	 */
25
+	public function get(string $url, array $options = []);
26 26
 
27
-    /**
28
-     * Make a 'DELETE' request
29
-     * 
30
-     * @param string $url The request url
31
-     * @param array $options The request options
32
-     * @return void
33
-     * @throws \tbclla\Revolut\Exceptions\ApiException API returned a 4xx or 5xx response code
34
-     */
35
-    public function delete(string $url, array $options = []);
27
+	/**
28
+	 * Make a 'DELETE' request
29
+	 * 
30
+	 * @param string $url The request url
31
+	 * @param array $options The request options
32
+	 * @return void
33
+	 * @throws \tbclla\Revolut\Exceptions\ApiException API returned a 4xx or 5xx response code
34
+	 */
35
+	public function delete(string $url, array $options = []);
36 36
 }
Please login to merge, or discard this patch.
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.
src/database/migrations/2019_08_19_000000_create_revolut_tokens_table.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -6,30 +6,30 @@
 block discarded – undo
6 6
 
7 7
 class CreateRevolutTokensTable extends Migration
8 8
 {
9
-    /**
10
-     * Run the migrations.
11
-     *
12
-     * @return void
13
-     */
14
-    public function up()
15
-    {
16
-        Schema::create(config('revolut.tokens.database.table_name'), function(Blueprint $table) {
17
-            $table->bigIncrements('id');
18
-            $table->string('type');
19
-            $table->mediumText('value');
20
-            $table->boolean('is_encrypted')->default(false);
21
-            $table->timestamp('expires_at')->nullable();
22
-            $table->timestamp('created_at')->useCurrent();
23
-        });
24
-    }
9
+	/**
10
+	 * Run the migrations.
11
+	 *
12
+	 * @return void
13
+	 */
14
+	public function up()
15
+	{
16
+		Schema::create(config('revolut.tokens.database.table_name'), function(Blueprint $table) {
17
+			$table->bigIncrements('id');
18
+			$table->string('type');
19
+			$table->mediumText('value');
20
+			$table->boolean('is_encrypted')->default(false);
21
+			$table->timestamp('expires_at')->nullable();
22
+			$table->timestamp('created_at')->useCurrent();
23
+		});
24
+	}
25 25
 
26
-    /**
27
-     * Reverse the migrations.
28
-     *
29
-     * @return void
30
-     */
31
-    public function down()
32
-    {
33
-        Schema::dropIfExists(config('revolut.tokens.database.table_name'));
34
-    }
26
+	/**
27
+	 * Reverse the migrations.
28
+	 *
29
+	 * @return void
30
+	 */
31
+	public function down()
32
+	{
33
+		Schema::dropIfExists(config('revolut.tokens.database.table_name'));
34
+	}
35 35
 }
Please login to merge, or discard this patch.
src/Providers/RevolutServiceProvider.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -20,74 +20,74 @@
 block discarded – undo
20 20
 
21 21
 class RevolutServiceProvider extends ServiceProvider
22 22
 {
23
-    /**
24
-     * Register services.
25
-     *
26
-     * @return void
27
-     */
28
-    public function register()
29
-    {
30
-        $this->app->bind(CacheTokenRepository::class, function() {
31
-            return new CacheTokenRepository(
32
-                resolve(CacheFactory::class),
33
-                config('revolut.tokens.cache.driver')
34
-            );
35
-        });
23
+	/**
24
+	 * Register services.
25
+	 *
26
+	 * @return void
27
+	 */
28
+	public function register()
29
+	{
30
+		$this->app->bind(CacheTokenRepository::class, function() {
31
+			return new CacheTokenRepository(
32
+				resolve(CacheFactory::class),
33
+				config('revolut.tokens.cache.driver')
34
+			);
35
+		});
36 36
 
37
-        $this->app->bind(TokenRepository::class, function() {
38
-            return config('revolut.tokens.store') === 'database'
39
-                ? new DatabaseTokenRepository
40
-                :  resolve(CacheTokenRepository::class);
41
-        });
37
+		$this->app->bind(TokenRepository::class, function() {
38
+			return config('revolut.tokens.store') === 'database'
39
+				? new DatabaseTokenRepository
40
+				:  resolve(CacheTokenRepository::class);
41
+		});
42 42
 
43
-        $this->app->bind(MakesHttpRequests::class, GuzzleHttpClient::class);
43
+		$this->app->bind(MakesHttpRequests::class, GuzzleHttpClient::class);
44 44
 
45
-        $this->app->bind(ClientAssertion::class, function() {
46
-            return new ClientAssertion(
47
-                config('revolut.client_id'),
48
-                config('revolut.private_key'),
49
-                config('revolut.redirect_uri')
50
-            );
51
-        });
45
+		$this->app->bind(ClientAssertion::class, function() {
46
+			return new ClientAssertion(
47
+				config('revolut.client_id'),
48
+				config('revolut.private_key'),
49
+				config('revolut.redirect_uri')
50
+			);
51
+		});
52 52
 
53
-        $this->app->bind(AuthorizationCodeRequest::class, function() {
54
-            return new AuthorizationCodeRequest(
55
-                config('revolut.client_id'),
56
-                config('revolut.redirect_uri'),
57
-                config('revolut.sandbox')
58
-            );
59
-        });
53
+		$this->app->bind(AuthorizationCodeRequest::class, function() {
54
+			return new AuthorizationCodeRequest(
55
+				config('revolut.client_id'),
56
+				config('revolut.redirect_uri'),
57
+				config('revolut.sandbox')
58
+			);
59
+		});
60 60
 
61
-        $this->app->singleton('revolut', function() {
62
-            return resolve(Client::class);
63
-        });
64
-    }
61
+		$this->app->singleton('revolut', function() {
62
+			return resolve(Client::class);
63
+		});
64
+	}
65 65
 
66
-    /**
67
-     * Bootstrap services.
68
-     *
69
-     * @return void
70
-     */
71
-    public function boot()
72
-    {
73
-        $this->publishes([
74
-            __DIR__ . '/../config/revolut.php' => config_path('revolut.php')
75
-        ]);
66
+	/**
67
+	 * Bootstrap services.
68
+	 *
69
+	 * @return void
70
+	 */
71
+	public function boot()
72
+	{
73
+		$this->publishes([
74
+			__DIR__ . '/../config/revolut.php' => config_path('revolut.php')
75
+		]);
76 76
 
77
-        if (config('revolut.tokens.store') === 'database') {
78
-            $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
79
-        }
77
+		if (config('revolut.tokens.store') === 'database') {
78
+			$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
79
+		}
80 80
         
81
-        $this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
81
+		$this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
82 82
 
83
-        if ($this->app->runningInConsole()) {
84
-            $this->commands([
85
-                JWTCommand::class,
86
-                CleanupCommand::class,
87
-                ResetCommand::class,
88
-                AuthorizeCommand::class,
89
-                AccessTokenCommand::class,
90
-            ]);
91
-        }
92
-    }
83
+		if ($this->app->runningInConsole()) {
84
+			$this->commands([
85
+				JWTCommand::class,
86
+				CleanupCommand::class,
87
+				ResetCommand::class,
88
+				AuthorizeCommand::class,
89
+				AccessTokenCommand::class,
90
+			]);
91
+		}
92
+	}
93 93
 }
Please login to merge, or discard this patch.