/home/mjc1/public_html/plugin/nicepay/lib/nicepay/message/Header.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
/**
 * 
 * @author kblee
 *
 */
class Header {
    
/**
     * 
     * @var HEADER_LENGTH_KEY
     */
    
const HEADER_LENGTH_KEY "Length";
    
    
/**
     * 
     * @var HEADER_ID_KEY
     */
    
const HEADER_ID_KEY "ID";
    
    
/**
     * 
     * @var HEADER_VERSION_KEY
     */
    
const HEADER_VERSION_KEY "Version";
    
    
/**
     * 
     * @var $length
     */
    
private $length 0;
    
    
/**
     * 
     * @var $lengthPosition
     */
    
private $lengthPosition 0;
    
    
/**
     * 
     * @var $lengthPoSize
     */
    
private $lengthPoSize 0;
    
    
/**
     * 
     * @var unknown_type
     */
    
private $map;
    
    
/**
     * 
     */
    
public function Header(){
        
$this->map = array();
    }
    
    
/**
     * 
     */
    
public function getLength(){
        return 
$this->length;
    }

    
/**
     * 
     */
    
public function getLengthPosition(){
        return 
$this->lengthPosition;
    }

    
/**
     * 
     */
    
public function getLengthPoSize(){
        return 
$this->lengthPoSize;
    }

    
/**
     * 
     * @param $column
     */
    
public function add($column){
        
$this->map[$column->getName()]=$column;
    }

    
/**
     * 
     */
    
public function setup(){
        
$column null;

        
$sum 0;
        
        foreach(
$this->map as $key => $value){
            
$sum $sum $value->getSize();
        }
        
        
$this->length $sum;
        
        
$lec $this->map[Header::HEADER_LENGTH_KEY];
        
$this->lengthPoSize $lec->getSize();


        
$lp 0;
        
        foreach(
$this->map as $key=>$value){
            
$col $this->map[$key];
            if(
$col->getName() == Header::HEADER_LENGTH_KEY){
                break;
            }
            
$lp+=($col->getSize());
        }
        
        
$this->lengthPosition $lp;
    }
    
    public function 
getMap(){
        return 
$this->map;
    }
}
?>