ClientApp   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A verifyAppCredentials() 0 16 4
1
<?php
2
3
namespace bSecure\Payments\Models;
4
5
use Exception;
6
use Illuminate\Database\Eloquent\Model;
0 ignored issues
show
Bug introduced by
The type Illuminate\Database\Eloquent\Model was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
class ClientApp extends Model
9
{
10
    public static function verifyAppCredentials($merchantClientId, $merchantClientSecret)
11
    {
12
        try {
13
            if (empty($merchantClientId)) {
14
                return ['client_id' => '', 'error' => true, 'message' => trans('bSecurePayments::messages.client.id.invalid')];
0 ignored issues
show
Bug introduced by
The function trans was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

14
                return ['client_id' => '', 'error' => true, 'message' => /** @scrutinizer ignore-call */ trans('bSecurePayments::messages.client.id.invalid')];
Loading history...
15
            } else if (empty($merchantClientSecret)) {
16
                return ['client_id' => '', 'error' => true, 'message' => trans('bSecurePayments::messages.client.secret.invalid')];
17
            } else {
18
                return [
19
                    'client_id' => $merchantClientId,
20
                    'client_secret' => $merchantClientSecret,
21
                    'error' => false,
22
                ];
23
            }
24
        } catch (Exception $e) {
25
            return ['client_id' => '', 'error' => true, 'message' => $e->getTraceAsString()];
26
        }
27
    }
28
}
29