EquityRepository::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Samerior\MobileMoney\Equity\Library;
3
4
/**
5
 * Class EquityRepository
6
 * @package Samerior\MobileMoney\Equity\Library
7
 */
8
class EquityRepository
9
{
10
    /**
11
     * The Equity API Endpoint.
12
     *
13
     * @var string
14
     */
15
    public $endpoint;
16
    /**
17
     * The callback URL to be queried on transaction completion.
18
     *
19
     * @var string
20
     */
21
    public $callbackUrl;
22
    /**
23
     * The callback method to be used.
24
     *
25
     * @var string
26
     */
27
    public $callbackMethod;
28
29
    /**
30
     * Set the system to use demo timestamp and password.
31
     *
32
     * @var bool
33
     */
34
    public $demo;
35
36
    /**
37
     * @var string
38
     */
39
    public $consumerKey;
40
    /**
41
     * @var string
42
     */
43
    public $consumerSecret;
44
    /**
45
     * @var string
46
     */
47
    public $authBasic;
48
    /**
49
     * @var string The username
50
     */
51
    public $username;
52
    /**
53
     * @var string Password
54
     */
55
    public $password;
56
57
    /**
58
     * Transactor constructor.
59
     *
60
     */
61
    public function __construct()
62
    {
63
        $this->boot();
64
    }
65
66
    /**
67
     * Boot up the instance.
68
     */
69
    protected function boot()
70
    {
71
        $this->configure();
72
    }
73
74
    /**
75
     * Configure the instance and pick configurations from the config file.
76
     */
77
    protected function configure()
78
    {
79
        $this->setupBroker();
80
//        $this->setupGateway();
81
        $this->setNumberGenerator();
82
    }
83
84
    /**
85
     * Set up the API Broker endpoint and callback
86
     */
87
    protected function setupBroker()
88
    {
89
        $this->endpoint = (object)[
90
            'identity' =>config('payments.equity.endpoint-identity'),
91
            'transaction' => config('payments.equity.endpoint-transaction'),
92
        ];
93
        $this->callbackUrl = config('payments.equity.callback_url');
94
        $this->callbackMethod = config('payments.equity.callback_method');
95
        $this->consumerSecret = config('payments.equity.consumer_secret');
96
        $this->consumerKey = config('payments.equity.consumer_key');
97
        $this->username = config('payments.equity.username');
98
        $this->password = config('payments.equity.password');
99
        $this->authBasic = base64_encode($this->consumerKey . ':' . $this->consumerSecret);
100
        $this->demo = config('payments.equity.demo');
101
    }
102
103
104
    protected function setupGateway()
105
    {
106
        $this->paybillNumber = config('payments.equity.consumer_secret');
0 ignored issues
show
Bug introduced by
The property paybillNumber does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
107
        $this->passkey = config('payments.equity.consumer_key');
0 ignored issues
show
Bug introduced by
The property passkey does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
108
        $this->demo = config('payments.equity.mode');
109
    }
110
111
    protected function setNumberGenerator()
112
    {
113
        $this->transactionGenerator = config('payments.equity.transaction_id_handler');
0 ignored issues
show
Bug introduced by
The property transactionGenerator does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
114
    }
115
}
116