Payment   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 18
c 3
b 0
f 0
dl 0
loc 88
rs 10
wmc 7

6 Methods

Rating   Name   Duplication   Size   Complexity  
A Account() 0 3 1
A __construct() 0 3 1
A OrderId() 0 3 1
A Amount() 0 3 1
A parse_request_data() 0 11 2
A validate_request() 0 7 1
1
<?php
2
3
/**
4
 *      Class for Payment request
5
 *
6
 *      @package php_EasyPay
7
 *      @version 1.1
8
 *      @author Dmitry Shovchko <[email protected]>
9
 *
10
 */
11
12
namespace EasyPay\Provider31\Request;
13
14
use EasyPay\Log as Log;
15
use EasyPay\Exception;
16
17
class Payment extends General
18
{
19
    /**
20
     *      @var string 'Account' node
21
     */
22
    protected $Account;
23
24
    /**
25
     *      @var string 'OrderId' node
26
     */
27
    protected $OrderId;
28
29
    /**
30
     *      @var string 'Amount' node
31
     */
32
    protected $Amount;
33
34
    /**
35
     *      Payment constructor
36
     *
37
     *      @param \EasyPay\Provider31\Request\RAW $raw Raw request data
38
     */
39
    public function __construct($raw)
40
    {
41
        parent::__construct($raw);
42
    }
43
44
    /**
45
     *      Get Account
46
     *
47
     *      @return string
48
     */
49
    public function Account()
50
    {
51
        return $this->Account;
52
    }
53
54
    /**
55
     *      Get OrderId
56
     *
57
     *      @return string
58
     */
59
    public function OrderId()
60
    {
61
        return $this->OrderId;
62
    }
63
64
    /**
65
     *      Get Amount
66
     *
67
     *      @return string
68
     */
69
    public function Amount()
70
    {
71
        return $this->Amount;
72
    }
73
74
    /**
75
     *      Parse xml-request, which was previously "extracted" from the body of the http request
76
     *
77
     */
78
    protected function parse_request_data()
79
    {
80
        parent::parse_request_data();
81
82
        $r = $this->raw_request->get_nodes_from_request('Payment');
83
84
        foreach ($r[0]->childNodes as $child)
85
        {
86
            $this->check_and_parse_request_node($child, 'Account');
87
            $this->check_and_parse_request_node($child, 'OrderId');
88
            $this->check_and_parse_request_node($child, 'Amount');
89
        }
90
    }
91
92
    /**
93
     *      validate Payment request
94
     *
95
     *      @param array $options
96
     *      @throws Exception\Structure
97
     */
98
    public function validate_request($options)
99
    {
100
        parent::validate_request($options);
101
102
        $this->validate_element('Account');
103
        $this->validate_element('OrderId');
104
        $this->validate_element('Amount');
105
    }
106
}
107