1 | <?php |
||
14 | class WC_Item_Tax extends WC_Item { |
||
15 | |||
16 | /** |
||
17 | * Data array. |
||
18 | * @since 2.7.0 |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $data = array( |
||
22 | 'rate_code' => '', |
||
23 | 'rate_id' => 0, |
||
24 | 'label' => '', |
||
25 | 'compound' => false, |
||
26 | 'tax_total' => 0, |
||
27 | 'shipping_tax_total' => 0, |
||
28 | ); |
||
29 | |||
30 | /** |
||
31 | * Is this a compound tax rate? |
||
32 | * @return boolean |
||
33 | */ |
||
34 | public function is_compound() { |
||
37 | |||
38 | /** |
||
39 | * Backwards compatibility for directly accessed props. |
||
40 | * @param string $key |
||
41 | * @return mixed |
||
42 | */ |
||
43 | public function __get( $key ) { |
||
59 | |||
60 | /* |
||
61 | |-------------------------------------------------------------------------- |
||
62 | | Setters |
||
63 | |-------------------------------------------------------------------------- |
||
64 | */ |
||
65 | |||
66 | /** |
||
67 | * Set item name. |
||
68 | * @param string $value |
||
69 | * @throws WC_Data_Exception |
||
70 | */ |
||
71 | public function set_rate_code( $value ) { |
||
74 | |||
75 | /** |
||
76 | * Set item name. |
||
77 | * @param string $value |
||
78 | * @throws WC_Data_Exception |
||
79 | */ |
||
80 | public function set_label( $value ) { |
||
83 | |||
84 | /** |
||
85 | * Set tax rate id. |
||
86 | * @param int $value |
||
87 | * @throws WC_Data_Exception |
||
88 | */ |
||
89 | public function set_rate_id( $value ) { |
||
92 | |||
93 | /** |
||
94 | * Set tax total. |
||
95 | * @param string $value |
||
96 | * @throws WC_Data_Exception |
||
97 | */ |
||
98 | public function set_tax_total( $value ) { |
||
101 | |||
102 | /** |
||
103 | * Set shipping_tax_total |
||
104 | * @param string $value |
||
105 | * @throws WC_Data_Exception |
||
106 | */ |
||
107 | public function set_shipping_tax_total( $value ) { |
||
110 | |||
111 | /** |
||
112 | * Set compound |
||
113 | * @param bool $value |
||
114 | * @throws WC_Data_Exception |
||
115 | */ |
||
116 | public function set_compound( $value ) { |
||
119 | |||
120 | /** |
||
121 | * Set properties based on passed in tax rate by ID. |
||
122 | * @param int $tax_rate_id |
||
123 | * @throws WC_Data_Exception |
||
124 | */ |
||
125 | public function set_rate( $tax_rate_id ) { |
||
131 | |||
132 | /* |
||
133 | |-------------------------------------------------------------------------- |
||
134 | | Getters |
||
135 | |-------------------------------------------------------------------------- |
||
136 | */ |
||
137 | |||
138 | /** |
||
139 | * Get order item type. |
||
140 | * @return string |
||
141 | */ |
||
142 | public function get_type() { |
||
145 | |||
146 | /** |
||
147 | * Get rate code/name. |
||
148 | * @return string |
||
149 | */ |
||
150 | public function get_rate_code() { |
||
153 | |||
154 | /** |
||
155 | * Get label. |
||
156 | * @return string |
||
157 | */ |
||
158 | public function get_label() { |
||
161 | |||
162 | /** |
||
163 | * Get tax rate ID. |
||
164 | * @return int |
||
165 | */ |
||
166 | public function get_rate_id() { |
||
169 | |||
170 | /** |
||
171 | * Get tax_total |
||
172 | * @return string |
||
173 | */ |
||
174 | public function get_tax_total() { |
||
177 | |||
178 | /** |
||
179 | * Get shipping_tax_total |
||
180 | * @return string |
||
181 | */ |
||
182 | public function get_shipping_tax_total() { |
||
185 | |||
186 | /** |
||
187 | * Get compound. |
||
188 | * @return bool |
||
189 | */ |
||
190 | public function get_compound() { |
||
193 | } |
||
194 |