1 | <?php |
||
14 | class WC_Order_Item_Tax extends WC_Order_Item { |
||
15 | |||
16 | /** |
||
17 | * Data properties of this order item object. |
||
18 | * @since 2.6.0 |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $_data = array( |
||
22 | 'order_id' => 0, |
||
23 | 'order_item_id' => 0, |
||
24 | 'rate_code' => '', |
||
25 | 'rate_id' => 0, |
||
26 | 'label' => '', |
||
27 | 'compound' => false, |
||
28 | 'tax_total' => 0, |
||
29 | 'shipping_tax_total' => 0 |
||
30 | ); |
||
31 | |||
32 | /** |
||
33 | * Read/populate data properties specific to this order item. |
||
34 | */ |
||
35 | public function read( $id ) { |
||
45 | |||
46 | /** |
||
47 | * Save properties specific to this order item. |
||
48 | * @return int Item ID |
||
49 | */ |
||
50 | public function save() { |
||
62 | |||
63 | /** |
||
64 | * Internal meta keys we don't want exposed as part of meta_data. |
||
65 | * @return array() |
||
66 | */ |
||
67 | protected function get_internal_meta_keys() { |
||
70 | |||
71 | /** |
||
72 | * Is this a compound tax rate? |
||
73 | * @return boolean |
||
74 | */ |
||
75 | public function is_compound() { |
||
78 | |||
79 | /* |
||
80 | |-------------------------------------------------------------------------- |
||
81 | | Setters |
||
82 | |-------------------------------------------------------------------------- |
||
83 | */ |
||
84 | |||
85 | /** |
||
86 | * Set order item name. |
||
87 | * @param string $value |
||
88 | */ |
||
89 | public function set_name( $value ) { |
||
92 | |||
93 | /** |
||
94 | * Set item name. |
||
95 | * @param string $value |
||
96 | */ |
||
97 | public function set_rate_code( $value ) { |
||
100 | |||
101 | /** |
||
102 | * Set item name. |
||
103 | * @param string $value |
||
104 | */ |
||
105 | public function set_label( $value ) { |
||
108 | |||
109 | /** |
||
110 | * Set tax rate id. |
||
111 | * @param int $value |
||
112 | */ |
||
113 | public function set_rate_id( $value ) { |
||
116 | |||
117 | /** |
||
118 | * Set tax total. |
||
119 | * @param string $value |
||
120 | */ |
||
121 | public function set_tax_total( $value ) { |
||
124 | |||
125 | /** |
||
126 | * Set shipping_tax_total |
||
127 | * @param string $value |
||
128 | */ |
||
129 | public function set_shipping_tax_total( $value ) { |
||
132 | |||
133 | /** |
||
134 | * Set compound |
||
135 | * @param bool $value |
||
136 | */ |
||
137 | public function set_compound( $value ) { |
||
140 | |||
141 | /* |
||
142 | |-------------------------------------------------------------------------- |
||
143 | | Getters |
||
144 | |-------------------------------------------------------------------------- |
||
145 | */ |
||
146 | |||
147 | /** |
||
148 | * Get order item type. |
||
149 | * @return string |
||
150 | */ |
||
151 | public function get_type() { |
||
154 | |||
155 | /** |
||
156 | * Get rate code/name. |
||
157 | * @return string |
||
158 | */ |
||
159 | public function get_name() { |
||
162 | |||
163 | /** |
||
164 | * Get rate code/name. |
||
165 | * @return string |
||
166 | */ |
||
167 | public function get_rate_code() { |
||
170 | |||
171 | /** |
||
172 | * Get label. |
||
173 | * @return string |
||
174 | */ |
||
175 | public function get_label() { |
||
178 | |||
179 | /** |
||
180 | * Get tax rate ID. |
||
181 | * @return int |
||
182 | */ |
||
183 | public function get_rate_id() { |
||
186 | |||
187 | /** |
||
188 | * Get tax_total |
||
189 | * @return string |
||
190 | */ |
||
191 | public function get_tax_total() { |
||
194 | |||
195 | /** |
||
196 | * Get shipping_tax_total |
||
197 | * @return string |
||
198 | */ |
||
199 | public function get_shipping_tax_total() { |
||
202 | |||
203 | /** |
||
204 | * Get compound. |
||
205 | * @return bool |
||
206 | */ |
||
207 | public function get_compound() { |
||
210 | } |
||
211 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.