Issues (7)

src/Tatum.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace HopekellDev\LaravelTatum;
4
5
use GuzzleHttp\Client;
6
use HopekellDev\Tatum\Helpers\Blockchain;
7
use HopekellDev\Tatum\Helpers\Utils;
8
use HopekellDev\Tatum\Helpers\VirtualAccount;
9
10
class Tatum
11
{
12
    protected $apiKey;
13
    protected $accountID;
14
    protected $baseUrl;
15
16
    /**
17
     * Construct
18
     */
19
    function __construct()
20
    {
21
22
        $this->apiKey = config('tatum.apiKey');
0 ignored issues
show
The function config 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

22
        $this->apiKey = /** @scrutinizer ignore-call */ config('tatum.apiKey');
Loading history...
23
        $this->accountID = config('tatum.accountID');
24
        $this->baseUrl = 'https://api.tatum.io/v3';
25
    }
26
27
    /**
28
     * Generates a unique reference
29
     * @param $transactionPrefix
30
     * @return string
31
     */
32
33
    public function generateReference(String $transactionPrefix = NULL)
34
    {
35
        if ($transactionPrefix) {
36
            return $transactionPrefix . '_' . uniqid(time());
37
        }
38
        return 'ttm_' . uniqid(time());
39
    }
40
41
    /**
42
     * Access available blockchains
43
     * @return Blockchain
44
     */
45
    public function blockchain()
46
    {
47
        $blockchain = new Blockchain($this->apiKey, $this->accountID, $this->baseUrl);
48
        return $blockchain;
49
    }
50
51
    /**
52
     * Access Tatum Utils
53
     * @return Utils
54
     */
55
    public function utils()
56
    {
57
        $utils = new Utils($this->apiKey, $this->accountID, $this->baseUrl);
58
        return $utils;
59
    }
60
61
    public function virtualAccount()
62
    {
63
        $virtualAccount = new VirtualAccount($this->apiKey, $this->accountID, $this->baseUrl);
64
        return $virtualAccount;
65
    }
66
}
67