Check::create_AccountInfo()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 5
c 1
b 0
f 1
nc 3
nop 1
dl 0
loc 10
rs 10
1
<?php
2
3
/**
4
 *      Class for response to Check request
5
 *
6
 *      @package php_EasyPay
7
 *      @version 1.1
8
 *      @author Dmitry Shovchko <[email protected]>
9
 *
10
 */
11
12
namespace EasyPay\Provider31\Response;
13
14
use \EasyPay\Provider31\Response as Response;
15
use \EasyPay\Provider31\AccountInfo as AccountInfo;
16
17
final class Check extends Response
18
{
19
    /**
20
     *      @var \DOMElement
21
     */
22
    protected $AccountInfo;
23
24
	/**
25
     *      Check constructor
26
     *
27
     *      @param AccountInfo $accountinfo account information set
28
     */
29
    public function __construct(AccountInfo $accountinfo)
30
    {
31
		parent::__construct();
32
33
		$this->setElementValue('StatusCode', 0);
34
		$this->setElementValue('StatusDetail', 'checked');
35
36
		$this->create_AccountInfo($accountinfo);
37
	}
38
39
	/**
40
     *      Create AccountInfo node with child nodes
41
     *
42
     *      @param AccountInfo $accountinfo account information set
43
     */
44
	public function create_AccountInfo($accountinfo)
45
	{
46
		if (isset($this->AccountInfo)) return;
47
48
		$this->AccountInfo = $this->createElement('AccountInfo');
49
		$this->Response->appendChild($this->AccountInfo);
50
51
		foreach($accountinfo as $parameter=>$value)
52
		{
53
			$this->AccountInfo->appendChild($this->createElement($parameter, $value));
54
		}
55
	}
56
}
57