Passed
Push — master ( 046212...e3ed84 )
by Dominic
02:47
created
src/routes/web.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,5 +13,5 @@
 block discarded – undo
13 13
 */
14 14
 
15 15
 Route::group(['namespace' => 'tbclla\Revolut\Controllers'], function() {
16
-    Route::get(parse_url(config('revolut.redirect_uri'))['path'], 'AuthorizationController');
16
+	Route::get(parse_url(config('revolut.redirect_uri'))['path'], 'AuthorizationController');
17 17
 });
Please login to merge, or discard this patch.
src/Client.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return string
129 129
 	 */
130 130
 	public static function buildUri(string $endpoint = '')
131
-    {
131
+	{
132 132
 		$url = config('revolut.sandbox', true) ? self::SANDBOX_URL : self::PRODUCTION_URL;
133 133
 
134 134
 		return $url . self::apiUri() . $endpoint;
@@ -146,37 +146,37 @@  discard block
 block discarded – undo
146 146
 	/**
147 147
 	 * Perform a POST request against a specified endpoint
148 148
 	 * 
149
-     * @param string $endpoint
150
-     * @param array $options
151
-     * @return array
149
+	 * @param string $endpoint
150
+	 * @param array $options
151
+	 * @return array
152 152
 	 * @throws \tbclla\Revolut\Exceptions\ApiException
153
-     */
154
-    public function post(string $endpoint, array $options = [])
155
-    {
153
+	 */
154
+	public function post(string $endpoint, array $options = [])
155
+	{
156 156
 		return $this->httpClient->post($this->buildUri($endpoint), $this->buildOptions($options));
157
-    }
157
+	}
158 158
 
159
-    /**
159
+	/**
160 160
 	 * Perform a GET request against a specified endpoint
161 161
 	 * 
162
-     * @param string $endpoint
163
-     * @return array
162
+	 * @param string $endpoint
163
+	 * @return array
164 164
 	 * @throws \tbclla\Revolut\Exceptions\ApiException
165
-     */
166
-    public function get(string $endpoint, array $options = [])
167
-    {
165
+	 */
166
+	public function get(string $endpoint, array $options = [])
167
+	{
168 168
 		return $this->httpClient->get($this->buildUri($endpoint), $this->buildOptions($options));
169 169
 	}
170 170
 
171
-    /**
171
+	/**
172 172
 	 * Perform a DELETE request against a specified endpoint
173 173
 	 * 
174
-     * @param string $endpoint
175
-     * @return void
174
+	 * @param string $endpoint
175
+	 * @return void
176 176
 	 * @throws \tbclla\Revolut\Exceptions\ApiException
177
-     */
178
-    public function delete(string $endpoint)
179
-    {
177
+	 */
178
+	public function delete(string $endpoint)
179
+	{
180 180
 		return $this->httpClient->delete($this->buildUri($endpoint), $this->buildOptions());
181 181
 	}
182 182
 
Please login to merge, or discard this patch.
src/Resources/Account.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,22 +19,22 @@  discard block
 block discarded – undo
19 19
 	 * @throws \tbclla\Revolut\Exceptions\ApiException
20 20
 	 */
21 21
 	public function all()
22
-    {
23
-        return $this->client->get(self::ENDPOINT);
22
+	{
23
+		return $this->client->get(self::ENDPOINT);
24 24
 	}
25 25
 
26 26
 
27
-    /**
27
+	/**
28 28
 	 * Get an account by its ID
29 29
 	 * @throws \tbclla\Revolut\Exceptions\ApiException
30 30
 	 * 
31 31
 	 * @see https://revolut-engineering.github.io/api-docs/business-api/#accounts-get-account Official API documentation
32
-     * @param string $id The account ID in UUID format
33
-     * @return array
34
-     */
35
-    public function get(string $id)
36
-    {
37
-        return $this->client->get(self::ENDPOINT . '/' . $id);
32
+	 * @param string $id The account ID in UUID format
33
+	 * @return array
34
+	 */
35
+	public function get(string $id)
36
+	{
37
+		return $this->client->get(self::ENDPOINT . '/' . $id);
38 38
 	}
39 39
 
40 40
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @return array
46 46
 	 */
47 47
 	public function details(string $id)
48
-    {
49
-        return $this->client->get(self::ENDPOINT . '/' . $id . '/bank-details');
50
-    }
48
+	{
49
+		return $this->client->get(self::ENDPOINT . '/' . $id . '/bank-details');
50
+	}
51 51
 }
Please login to merge, or discard this patch.
src/Facades/Revolut.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@
 block discarded – undo
7 7
 class Revolut extends Facade
8 8
 {
9 9
 	/**
10
-     * Get the registered name of the component.
11
-     *
12
-     * @return string
13
-     */
10
+	 * Get the registered name of the component.
11
+	 *
12
+	 * @return string
13
+	 */
14 14
 	protected static function getFacadeAccessor()
15 15
 	{
16 16
 		return 'revolut';
Please login to merge, or discard this patch.
src/Providers/RevolutServiceProvider.php 1 patch
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -16,66 +16,66 @@
 block discarded – undo
16 16
 
17 17
 class RevolutServiceProvider extends ServiceProvider
18 18
 {
19
-    /**
20
-     * Register services.
21
-     *
22
-     * @return void
23
-     */
24
-    public function register()
25
-    {
26
-        $this->app->bind(MakesHttpRequests::class, GuzzleHttpClient::class);
19
+	/**
20
+	 * Register services.
21
+	 *
22
+	 * @return void
23
+	 */
24
+	public function register()
25
+	{
26
+		$this->app->bind(MakesHttpRequests::class, GuzzleHttpClient::class);
27 27
 
28
-        $this->app->bind(ClientAssertion::class, function() {
29
-            return new ClientAssertion(
30
-                config('revolut.client_id'),
31
-                config('revolut.private_key'),
32
-                config('revolut.redirect_uri')
33
-            );
34
-        });
28
+		$this->app->bind(ClientAssertion::class, function() {
29
+			return new ClientAssertion(
30
+				config('revolut.client_id'),
31
+				config('revolut.private_key'),
32
+				config('revolut.redirect_uri')
33
+			);
34
+		});
35 35
 
36
-        $this->app->bind(AuthorizationCodeRequest::class, function() {
37
-            return new AuthorizationCodeRequest(
38
-                resolve(TokenRepository::class),
39
-                config('revolut.client_id'),
40
-                config('revolut.redirect_uri'),
41
-                config('revolut.sandbox')
42
-            );
43
-        });
36
+		$this->app->bind(AuthorizationCodeRequest::class, function() {
37
+			return new AuthorizationCodeRequest(
38
+				resolve(TokenRepository::class),
39
+				config('revolut.client_id'),
40
+				config('revolut.redirect_uri'),
41
+				config('revolut.sandbox')
42
+			);
43
+		});
44 44
 
45
-        $this->app->singleton('revolut', function() {
46
-            return resolve(Client::class);
47
-        });
48
-    }
45
+		$this->app->singleton('revolut', function() {
46
+			return resolve(Client::class);
47
+		});
48
+	}
49 49
 
50
-    /**
51
-     * Bootstrap services.
52
-     *
53
-     * @return void
54
-     */
55
-    public function boot()
56
-    {
57
-        $this->publishes([
58
-            __DIR__ . '/../config/revolut.php' => config_path('revolut.php')
59
-        ]);
50
+	/**
51
+	 * Bootstrap services.
52
+	 *
53
+	 * @return void
54
+	 */
55
+	public function boot()
56
+	{
57
+		$this->publishes([
58
+			__DIR__ . '/../config/revolut.php' => config_path('revolut.php')
59
+		]);
60 60
 
61
-        $this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
61
+		$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
62 62
 
63
-        $this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
63
+		$this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
64 64
 
65
-        $this->commands([
66
-            JWTCommand::class,
67
-            CleanupCommand::class,
68
-            ResetCommand::class,
69
-            AuthorizeCommand::class,
70
-        ]);
65
+		$this->commands([
66
+			JWTCommand::class,
67
+			CleanupCommand::class,
68
+			ResetCommand::class,
69
+			AuthorizeCommand::class,
70
+		]);
71 71
 
72
-        // if ($this->app->runningInConsole()) {
73
-        //     $this->commands([
74
-        //         JWTCommand::class,
75
-        //         CleanupCommand::class,
76
-        //         ResetCommand::class,
77
-        //         AuthorizeCommand::class,
78
-        //     ]);
79
-        // }
80
-    }
72
+		// if ($this->app->runningInConsole()) {
73
+		//     $this->commands([
74
+		//         JWTCommand::class,
75
+		//         CleanupCommand::class,
76
+		//         ResetCommand::class,
77
+		//         AuthorizeCommand::class,
78
+		//     ]);
79
+		// }
80
+	}
81 81
 }
Please login to merge, or discard this patch.
src/config/revolut.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
     | authorization process.
24 24
     |
25 25
     */
26
-    'private_key' => env('REVOLUT_PRIVATE_KEY'),
26
+	'private_key' => env('REVOLUT_PRIVATE_KEY'),
27 27
 
28
-    /*
28
+	/*
29 29
     |--------------------------------------------------------------------------
30 30
     | Client ID
31 31
     |--------------------------------------------------------------------------
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
     | selecting the relevant API certificate.
36 36
     |
37 37
     */
38
-    'client_id' => env('REVOLUT_CLIENT_ID'),
38
+	'client_id' => env('REVOLUT_CLIENT_ID'),
39 39
     
40
-    /*
40
+	/*
41 41
     |--------------------------------------------------------------------------
42 42
     | Oauth Redirect URI
43 43
     |--------------------------------------------------------------------------
@@ -46,9 +46,9 @@  discard block
 block discarded – undo
46 46
     | process. This must match the uri provided to Revolut.
47 47
     |
48 48
     */
49
-    'redirect_uri' => env('REVOLUT_REDIRECT_URI'),
49
+	'redirect_uri' => env('REVOLUT_REDIRECT_URI'),
50 50
 
51
-    /*
51
+	/*
52 52
     |--------------------------------------------------------------------------
53 53
     | Encryption
54 54
     |--------------------------------------------------------------------------
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
     | production environment
59 59
     |
60 60
     */
61
-    'encrypt_tokens' => true,
61
+	'encrypt_tokens' => true,
62 62
     
63
-    /*
63
+	/*
64 64
     |--------------------------------------------------------------------------
65 65
     | Tokens table
66 66
     |--------------------------------------------------------------------------
@@ -68,5 +68,5 @@  discard block
 block discarded – undo
68 68
     | Set the name of the table that will hold your Revolut tokens.
69 69
     |
70 70
     */
71
-    'tokens_table' => 'revolut_tokens'
71
+	'tokens_table' => 'revolut_tokens'
72 72
 ];
Please login to merge, or discard this patch.
src/Traits/Encryptable.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,15 +18,15 @@
 block discarded – undo
18 18
 				$model->is_encrypted = true;
19 19
 				$model->value = $model->encryptValue();
20 20
 			}
21
-        });
21
+		});
22 22
 	}
23 23
 
24 24
 	/**
25
-     * Get the decrypted value attribute.
26
-     *
27
-     * @param  string  $value
28
-     * @return string
29
-     */
25
+	 * Get the decrypted value attribute.
26
+	 *
27
+	 * @param  string  $value
28
+	 * @return string
29
+	 */
30 30
 	public function getValueAttribute($value)
31 31
 	{
32 32
 		return $this->is_encrypted ? $this->decryptValue() : $value;
Please login to merge, or discard this patch.
src/Auth/Token.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
 	protected $fillable = ['value'];
26 26
 
27 27
 	/**
28
-     * The attributes that should be cast to native types.
29
-     *
30
-     * @var array
31
-     */
28
+	 * The attributes that should be cast to native types.
29
+	 *
30
+	 * @var array
31
+	 */
32 32
 	protected $casts = [
33 33
 		'is_encrypted' => 'boolean',
34 34
 		'expires_at' => 'datetime',
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 	];
37 37
 
38 38
 	/**
39
-     * The "booting" method of the model.
40
-     *
41
-     * @return void
42
-     */
43
-    protected static function boot()
44
-    {
39
+	 * The "booting" method of the model.
40
+	 *
41
+	 * @return void
42
+	 */
43
+	protected static function boot()
44
+	{
45 45
 		parent::boot();
46 46
 
47 47
 		static::creating(function($model) {
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 			$model->expires_at = static::getExpiration();
50 50
 		});
51 51
 
52
-        static::addGlobalScope('type', function(Builder $builder) {
53
-            $builder->whereType(static::getType());
52
+		static::addGlobalScope('type', function(Builder $builder) {
53
+			$builder->whereType(static::getType());
54 54
 		});
55 55
 	}
56 56
 
Please login to merge, or discard this patch.
src/Console/Commands/JWTCommand.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -10,74 +10,74 @@
 block discarded – undo
10 10
 
11 11
 class JWTCommand extends Command
12 12
 {
13
-    /**
14
-     * The name and signature of the console command.
15
-     *
16
-     * @var string
17
-     */
18
-    protected $signature = 'revolut:jwt {--public= : The path to your public key}';
13
+	/**
14
+	 * The name and signature of the console command.
15
+	 *
16
+	 * @var string
17
+	 */
18
+	protected $signature = 'revolut:jwt {--public= : The path to your public key}';
19 19
 
20
-    /**
21
-     * The console command description.
22
-     *
23
-     * @var string
24
-     */
25
-    protected $description = "Generate a JSON Web Token for Revolut's Oauth process.";
20
+	/**
21
+	 * The console command description.
22
+	 *
23
+	 * @var string
24
+	 */
25
+	protected $description = "Generate a JSON Web Token for Revolut's Oauth process.";
26 26
 
27
-    /**
28
-     * Execute the console command.
29
-     *
30
-     * @return mixed
31
-     */
32
-    public function handle()
33
-    {
34
-        // build the JWT
35
-        $jwt = $this->buildJWT();
27
+	/**
28
+	 * Execute the console command.
29
+	 *
30
+	 * @return mixed
31
+	 */
32
+	public function handle()
33
+	{
34
+		// build the JWT
35
+		$jwt = $this->buildJWT();
36 36
 
37
-        $this->info('Your JSON web token was created successfully:');
38
-        $this->info('<fg=black;bg=yellow>' . $jwt . '</>');
37
+		$this->info('Your JSON web token was created successfully:');
38
+		$this->info('<fg=black;bg=yellow>' . $jwt . '</>');
39 39
 
40
-        // optionally, verify the key
41
-        $key = $this->checkPublicKey($this->option('public') ?? null);
40
+		// optionally, verify the key
41
+		$key = $this->checkPublicKey($this->option('public') ?? null);
42 42
 
43
-        $decoded = JWT::decode($jwt, $key, [ClientAssertion::ALGORYTHM]);
43
+		$decoded = JWT::decode($jwt, $key, [ClientAssertion::ALGORYTHM]);
44 44
 
45
-        $headers = ['parameter', 'value'];
46
-        $data = [
47
-            ['issuer', $decoded->iss],
48
-            ['subject', $decoded->sub],
49
-            ['expiry', $decoded->exp],
50
-            ['audience', $decoded->aud],
51
-        ];
45
+		$headers = ['parameter', 'value'];
46
+		$data = [
47
+			['issuer', $decoded->iss],
48
+			['subject', $decoded->sub],
49
+			['expiry', $decoded->exp],
50
+			['audience', $decoded->aud],
51
+		];
52 52
 
53
-        $this->info('Your JWT has been verified and is valid.');
54
-        $this->table($headers, $data);
55
-    }
53
+		$this->info('Your JWT has been verified and is valid.');
54
+		$this->table($headers, $data);
55
+	}
56 56
 
57
-    /**
58
-     * @return string
59
-     */
60
-    private function buildJWT()
61
-    {
62
-        try {
63
-            $clientAssertion = resolve(ClientAssertion::class);
64
-            return $clientAssertion->build();
65
-        } catch (ConfigurationException $e) {
66
-            $this->error($e->getMessage());
67
-            return;
68
-        }
69
-    }
57
+	/**
58
+	 * @return string
59
+	 */
60
+	private function buildJWT()
61
+	{
62
+		try {
63
+			$clientAssertion = resolve(ClientAssertion::class);
64
+			return $clientAssertion->build();
65
+		} catch (ConfigurationException $e) {
66
+			$this->error($e->getMessage());
67
+			return;
68
+		}
69
+	}
70 70
 
71
-    /**
72
-     * @return string
73
-     */
74
-    private function checkPublicKey($key = null)
75
-    {
76
-        try {
77
-            return file_get_contents($key ?? $this->ask('If you want to validate this JWT, enter the path to your private key'));
78
-        } catch (Exception $e) {
79
-            $this->error($e->getMessage());
80
-            return $this->checkPublicKey();
81
-        }
82
-    }
71
+	/**
72
+	 * @return string
73
+	 */
74
+	private function checkPublicKey($key = null)
75
+	{
76
+		try {
77
+			return file_get_contents($key ?? $this->ask('If you want to validate this JWT, enter the path to your private key'));
78
+		} catch (Exception $e) {
79
+			$this->error($e->getMessage());
80
+			return $this->checkPublicKey();
81
+		}
82
+	}
83 83
 }
Please login to merge, or discard this patch.