UserDetails::walletBalance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
namespace HopekellDev\DanArewa\Helpers;
4
5
use Illuminate\Support\Facades\Http;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Facades\Http 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...
6
7
/**
8
 * DanArewa's Identity Verification laravel package
9
 * @author Hope Ezenwa- Hopekell <[email protected]>
10
 * @version 1
11
 **/
12
13
class UserDetails
14
{
15
    protected string $apiKey;
16
    protected string $baseUrl;
17
18
    /**
19
     * Construct
20
     */
21
    public function __construct(string $apiKey, string $baseUrl)
22
    {
23
        $this->apiKey = $apiKey;
24
        $this->baseUrl = $baseUrl;
25
    }
26
27
    /**
28
     * Get user's wallet balance
29
     *
30
     * @return array|null
31
     */
32
    public function walletBalance(): ?array
33
    {
34
        $response = Http::withHeaders([
35
            'Authorization' => "Bearer {$this->apiKey}",
36
            'Content-Type'  => 'application/json',
37
        ])->get("{$this->baseUrl}/user/wallet");
38
39
        return $response->json() ?? null;
40
    }
41
42
}