Passed
Branch master (461ffe)
by João Felipe Magro
05:37 queued 02:32
created

Endpoint::setUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Ipag\Classes;
4
5
final class Endpoint
6
{
7
    const PRODUCTION = 'https://www.librepag.com.br';
8
    const SANDBOX = 'https://sandbox.ipag.com.br';
9
    const PAYMENT = '/pagamento';
10
    const CONSULT = '/consulta';
11
    const CAPTURE = '/captura';
12
    const CANCEL = '/cancela';
13
14
    /**
15
     * @var string
16
     */
17
    private $url;
18
19
    public function __construct($url = self::PRODUCTION)
20
    {
21
        $this->url = $url;
22
    }
23
24
    /**
25
     * @return string
26
     */
27
    public function payment()
28
    {
29
        return $this->url.self::PAYMENT;
30
    }
31
32
    /**
33
     * @return string
34
     */
35
    public function consult()
36
    {
37
        return $this->url.self::CONSULT;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function capture()
44
    {
45
        return $this->url.self::CAPTURE;
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function cancel()
52
    {
53
        return $this->url.self::CANCEL;
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getUrl()
60
    {
61
        return $this->url;
62
    }
63
64
    /**
65
     * @param string $url
66
     *
67
     * @return self
68
     */
69
    public function setUrl($url)
70
    {
71
        $this->url = $url;
72
73
        return $this;
74
    }
75
}
76