Completed
Push — master ( 6e1d34...22a8c1 )
by Jean C.
02:15
created

Moip   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 12
Bugs 0 Features 0
Metric Value
wmc 9
c 12
b 0
f 0
lcom 1
cbo 2
dl 0
loc 85
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A start() 0 4 1
A customers() 0 4 1
A entries() 0 4 1
A orders() 0 4 1
A payments() 0 4 1
A multiorders() 0 4 1
A getHomologated() 0 4 2
1
<?php
2
3
namespace Artesaos\Moip;
4
5
use Moip\Moip as Api;
6
use Moip\MoipBasicAuth;
7
8
class Moip
9
{
10
    /**
11
     * Class Moip sdk.
12
     *
13
     * @var \Moip\Moip
14
     **/
15
    private $moip;
16
17
    /**
18
     * Moip constructor.
19
     */
20
    function __construct()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
21
    {
22
        $this->moip = new Api(new MoipBasicAuth(config('moip.credentials.token'), config('moip.credentials.key')), $this->getHomologated());
23
    }
24
25
    /**
26
     * Start Moip sdk.
27
     */
28
    public function start()
29
    {
30
        return $this;
31
    }
32
33
    /**
34
     * Create a new Customer instance.
35
     *
36
     * @return \Moip\Resource\Customer
37
     */
38
    public function customers()
39
    {
40
        return $this->moip->customers();
41
    }
42
43
    /**
44
     * Create a new Entry instance.
45
     *
46
     * @return \Moip\Resource\Entry
47
     */
48
    public function entries()
49
    {
50
        return $this->moip->entries();
51
    }
52
53
    /**
54
     * Create a new Order instance.
55
     *
56
     * @return \Moip\Resource\Orders
57
     */
58
    public function orders()
59
    {
60
        return $this->moip->orders();
61
    }
62
63
    /**
64
     * Create a new Payment instance.
65
     *
66
     * @return \Moip\Resource\Payment
67
     */
68
    public function payments()
69
    {
70
        return $this->moip->payments();
71
    }
72
73
    /**
74
     * Create a new Multiorders instance.
75
     *
76
     * @return \Moip\Resource\Multiorders
77
     */
78
    public function multiorders()
79
    {
80
        return $this->moip->multiorders();
81
    }
82
83
    /**
84
     * Get endpoint of request.
85
     *
86
     * @return string
87
     */
88
    private function getHomologated()
89
    {
90
        return config('moip.homologated') === true ? Api::ENDPOINT_PRODUCTION : Api::ENDPOINT_SANDBOX;
91
    }
92
}
93