CreatePaymentLink::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 2
nc 2
nop 2
1
<?php
2
3
namespace Evilnet\Dotpay\DotpayApi\Requests;
4
5
use Evilnet\Dotpay\DotpayApi\Contracts\IRequest;
6
7
/**
8
 * Class CreatePaymentLink
9
 * @package Evilnet\Dotpay\DotpayApi\Requests
10
 */
11
class CreatePaymentLink extends AbstractRequest implements IRequest
12
{
13
    /**
14
     * @var
15
     */
16
    protected $amount;
17
    /**
18
     * @var
19
     */
20
    protected $currency;
21
    /**
22
     * @var
23
     */
24
    protected $description;
25
    /**
26
     * @var
27
     */
28
    protected $control;
29
    // protected $language;
30
    /**
31
     * @var int
32
     */
33
    protected $onlinetransfer = 1;
34
    /**
35
     * @var int
36
     */
37
    protected $ch_lock = 1;
38
    /**
39
     * @var int
40
     */
41
    protected $redirection_type = 0;
42
    /**
43
     * @var string
44
     */
45
    protected $buttontext = 'Return';
46
    /**
47
     * @var
48
     */
49
    protected $url;
50
    /**
51
     * @var
52
     */
53
    protected $urlc;
54
    /**
55
     * @var
56
     */
57
    protected $expiration_datetime;
58
    /**
59
     * @var array
60
     */
61
    protected $payer = [];
62
    /**
63
     * @var array
64
     */
65
    protected $recipient = [];
66
67
    /**
68
     * @var
69
     */
70
    protected $shop_id;
71
72
    /**
73
     * CreatePaymentLink constructor.
74
     * @param $shop_id
75
     * @param $data
76
     */
77
    public function __construct($shop_id, $data)
78
    {
79
        $this->shop_id = $shop_id;
80
81
        foreach ($data as $key => $value) {
82
            $this->$key = $value;
83
        }
84
    }
85
86
    /**
87
     * @return string
88
     */
89
    public function method()
90
    {
91
        return 'POST';
92
    }
93
94
    /**
95
     * @return string
96
     */
97
    public function path()
98
    {
99
        return 'api/v1/accounts/'.$this->shop_id.'/payment_links/';
100
    }
101
}
102