| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 613 | 
| Code Lines | 494 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 1069 | 	public function get_item_schema() { | 
            ||
| 1070 | $schema = array(  | 
            ||
| 1071 | '$schema' => 'http://json-schema.org/draft-04/schema#',  | 
            ||
| 1072 | 'title' => $this->post_type,  | 
            ||
| 1073 | 'type' => 'object',  | 
            ||
| 1074 | 'properties' => array(  | 
            ||
| 1075 | 'id' => array(  | 
            ||
| 1076 | 'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),  | 
            ||
| 1077 | 'type' => 'integer',  | 
            ||
| 1078 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1079 | 'readonly' => true,  | 
            ||
| 1080 | ),  | 
            ||
| 1081 | 'parent_id' => array(  | 
            ||
| 1082 | 'description' => __( 'Parent order ID.', 'woocommerce' ),  | 
            ||
| 1083 | 'type' => 'integer',  | 
            ||
| 1084 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1085 | ),  | 
            ||
| 1086 | 'status' => array(  | 
            ||
| 1087 | 'description' => __( 'Order status.', 'woocommerce' ),  | 
            ||
| 1088 | 'type' => 'string',  | 
            ||
| 1089 | 'default' => 'pending',  | 
            ||
| 1090 | 'enum' => $this->get_order_statuses(),  | 
            ||
| 1091 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1092 | ),  | 
            ||
| 1093 | 'order_key' => array(  | 
            ||
| 1094 | 'description' => __( 'Order key.', 'woocommerce' ),  | 
            ||
| 1095 | 'type' => 'string',  | 
            ||
| 1096 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1097 | 'readonly' => true,  | 
            ||
| 1098 | ),  | 
            ||
| 1099 | 'currency' => array(  | 
            ||
| 1100 | 'description' => __( 'Currency the order was created with, in ISO format.', 'woocommerce' ),  | 
            ||
| 1101 | 'type' => 'string',  | 
            ||
| 1102 | 'default' => get_woocommerce_currency(),  | 
            ||
| 1103 | 'enum' => array_keys( get_woocommerce_currencies() ),  | 
            ||
| 1104 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1105 | ),  | 
            ||
| 1106 | 'version' => array(  | 
            ||
| 1107 | 'description' => __( 'Version of WooCommerce when the order was made.', 'woocommerce' ),  | 
            ||
| 1108 | 'type' => 'integer',  | 
            ||
| 1109 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1110 | 'readonly' => true,  | 
            ||
| 1111 | ),  | 
            ||
| 1112 | 'prices_include_tax' => array(  | 
            ||
| 1113 | 'description' => __( 'Shows if the prices included tax during checkout.', 'woocommerce' ),  | 
            ||
| 1114 | 'type' => 'boolean',  | 
            ||
| 1115 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1116 | 'readonly' => true,  | 
            ||
| 1117 | ),  | 
            ||
| 1118 | 'date_created' => array(  | 
            ||
| 1119 | 'description' => __( "The date the order was created, in the site's timezone.", 'woocommerce' ),  | 
            ||
| 1120 | 'type' => 'date-time',  | 
            ||
| 1121 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1122 | 'readonly' => true,  | 
            ||
| 1123 | ),  | 
            ||
| 1124 | 'date_modified' => array(  | 
            ||
| 1125 | 'description' => __( "The date the order was last modified, in the site's timezone.", 'woocommerce' ),  | 
            ||
| 1126 | 'type' => 'date-time',  | 
            ||
| 1127 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1128 | 'readonly' => true,  | 
            ||
| 1129 | ),  | 
            ||
| 1130 | 'customer_id' => array(  | 
            ||
| 1131 | 'description' => __( 'User ID who owns the order. 0 for guests.', 'woocommerce' ),  | 
            ||
| 1132 | 'type' => 'integer',  | 
            ||
| 1133 | 'default' => 0,  | 
            ||
| 1134 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1135 | ),  | 
            ||
| 1136 | 'discount_total' => array(  | 
            ||
| 1137 | 'description' => __( 'Total discount amount for the order.', 'woocommerce' ),  | 
            ||
| 1138 | 'type' => 'string',  | 
            ||
| 1139 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1140 | 'readonly' => true,  | 
            ||
| 1141 | ),  | 
            ||
| 1142 | 'discount_tax' => array(  | 
            ||
| 1143 | 'description' => __( 'Total discount tax amount for the order.', 'woocommerce' ),  | 
            ||
| 1144 | 'type' => 'string',  | 
            ||
| 1145 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1146 | 'readonly' => true,  | 
            ||
| 1147 | ),  | 
            ||
| 1148 | 'shipping_total' => array(  | 
            ||
| 1149 | 'description' => __( 'Total shipping amount for the order.', 'woocommerce' ),  | 
            ||
| 1150 | 'type' => 'string',  | 
            ||
| 1151 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1152 | 'readonly' => true,  | 
            ||
| 1153 | ),  | 
            ||
| 1154 | 'shipping_tax' => array(  | 
            ||
| 1155 | 'description' => __( 'Total shipping tax amount for the order.', 'woocommerce' ),  | 
            ||
| 1156 | 'type' => 'string',  | 
            ||
| 1157 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1158 | 'readonly' => true,  | 
            ||
| 1159 | ),  | 
            ||
| 1160 | 'cart_tax' => array(  | 
            ||
| 1161 | 'description' => __( 'Sum of line item taxes only.', 'woocommerce' ),  | 
            ||
| 1162 | 'type' => 'string',  | 
            ||
| 1163 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1164 | 'readonly' => true,  | 
            ||
| 1165 | ),  | 
            ||
| 1166 | 'total' => array(  | 
            ||
| 1167 | 'description' => __( 'Grand total.', 'woocommerce' ),  | 
            ||
| 1168 | 'type' => 'string',  | 
            ||
| 1169 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1170 | 'readonly' => true,  | 
            ||
| 1171 | ),  | 
            ||
| 1172 | 'total_tax' => array(  | 
            ||
| 1173 | 'description' => __( 'Sum of all taxes.', 'woocommerce' ),  | 
            ||
| 1174 | 'type' => 'string',  | 
            ||
| 1175 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1176 | 'readonly' => true,  | 
            ||
| 1177 | ),  | 
            ||
| 1178 | 'billing' => array(  | 
            ||
| 1179 | 'description' => __( 'Billing address.', 'woocommerce' ),  | 
            ||
| 1180 | 'type' => 'array',  | 
            ||
| 1181 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1182 | 'properties' => array(  | 
            ||
| 1183 | 'first_name' => array(  | 
            ||
| 1184 | 'description' => __( 'First name.', 'woocommerce' ),  | 
            ||
| 1185 | 'type' => 'string',  | 
            ||
| 1186 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1187 | ),  | 
            ||
| 1188 | 'last_name' => array(  | 
            ||
| 1189 | 'description' => __( 'Last name.', 'woocommerce' ),  | 
            ||
| 1190 | 'type' => 'string',  | 
            ||
| 1191 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1192 | ),  | 
            ||
| 1193 | 'company' => array(  | 
            ||
| 1194 | 'description' => __( 'Company name.', 'woocommerce' ),  | 
            ||
| 1195 | 'type' => 'string',  | 
            ||
| 1196 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1197 | ),  | 
            ||
| 1198 | 'address_1' => array(  | 
            ||
| 1199 | 'description' => __( 'Address line 1.', 'woocommerce' ),  | 
            ||
| 1200 | 'type' => 'string',  | 
            ||
| 1201 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1202 | ),  | 
            ||
| 1203 | 'address_2' => array(  | 
            ||
| 1204 | 'description' => __( 'Address line 2.', 'woocommerce' ),  | 
            ||
| 1205 | 'type' => 'string',  | 
            ||
| 1206 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1207 | ),  | 
            ||
| 1208 | 'city' => array(  | 
            ||
| 1209 | 'description' => __( 'City name.', 'woocommerce' ),  | 
            ||
| 1210 | 'type' => 'string',  | 
            ||
| 1211 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1212 | ),  | 
            ||
| 1213 | 'state' => array(  | 
            ||
| 1214 | 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ),  | 
            ||
| 1215 | 'type' => 'string',  | 
            ||
| 1216 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1217 | ),  | 
            ||
| 1218 | 'postcode' => array(  | 
            ||
| 1219 | 'description' => __( 'Postal code.', 'woocommerce' ),  | 
            ||
| 1220 | 'type' => 'string',  | 
            ||
| 1221 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1222 | ),  | 
            ||
| 1223 | 'country' => array(  | 
            ||
| 1224 | 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce' ),  | 
            ||
| 1225 | 'type' => 'string',  | 
            ||
| 1226 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1227 | ),  | 
            ||
| 1228 | 'email' => array(  | 
            ||
| 1229 | 'description' => __( 'Email address.', 'woocommerce' ),  | 
            ||
| 1230 | 'type' => 'string',  | 
            ||
| 1231 | 'format' => 'email',  | 
            ||
| 1232 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1233 | ),  | 
            ||
| 1234 | 'phone' => array(  | 
            ||
| 1235 | 'description' => __( 'Phone number.', 'woocommerce' ),  | 
            ||
| 1236 | 'type' => 'string',  | 
            ||
| 1237 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1238 | ),  | 
            ||
| 1239 | ),  | 
            ||
| 1240 | ),  | 
            ||
| 1241 | 'shipping' => array(  | 
            ||
| 1242 | 'description' => __( 'Shipping address.', 'woocommerce' ),  | 
            ||
| 1243 | 'type' => 'array',  | 
            ||
| 1244 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1245 | 'properties' => array(  | 
            ||
| 1246 | 'first_name' => array(  | 
            ||
| 1247 | 'description' => __( 'First name.', 'woocommerce' ),  | 
            ||
| 1248 | 'type' => 'string',  | 
            ||
| 1249 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1250 | ),  | 
            ||
| 1251 | 'last_name' => array(  | 
            ||
| 1252 | 'description' => __( 'Last name.', 'woocommerce' ),  | 
            ||
| 1253 | 'type' => 'string',  | 
            ||
| 1254 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1255 | ),  | 
            ||
| 1256 | 'company' => array(  | 
            ||
| 1257 | 'description' => __( 'Company name.', 'woocommerce' ),  | 
            ||
| 1258 | 'type' => 'string',  | 
            ||
| 1259 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1260 | ),  | 
            ||
| 1261 | 'address_1' => array(  | 
            ||
| 1262 | 'description' => __( 'Address line 1.', 'woocommerce' ),  | 
            ||
| 1263 | 'type' => 'string',  | 
            ||
| 1264 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1265 | ),  | 
            ||
| 1266 | 'address_2' => array(  | 
            ||
| 1267 | 'description' => __( 'Address line 2.', 'woocommerce' ),  | 
            ||
| 1268 | 'type' => 'string',  | 
            ||
| 1269 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1270 | ),  | 
            ||
| 1271 | 'city' => array(  | 
            ||
| 1272 | 'description' => __( 'City name.', 'woocommerce' ),  | 
            ||
| 1273 | 'type' => 'string',  | 
            ||
| 1274 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1275 | ),  | 
            ||
| 1276 | 'state' => array(  | 
            ||
| 1277 | 'description' => __( 'ISO code or name of the state, province or district.', 'woocommerce' ),  | 
            ||
| 1278 | 'type' => 'string',  | 
            ||
| 1279 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1280 | ),  | 
            ||
| 1281 | 'postcode' => array(  | 
            ||
| 1282 | 'description' => __( 'Postal code.', 'woocommerce' ),  | 
            ||
| 1283 | 'type' => 'string',  | 
            ||
| 1284 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1285 | ),  | 
            ||
| 1286 | 'country' => array(  | 
            ||
| 1287 | 'description' => __( 'Country code in ISO 3166-1 alpha-2 format.', 'woocommerce' ),  | 
            ||
| 1288 | 'type' => 'string',  | 
            ||
| 1289 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1290 | ),  | 
            ||
| 1291 | ),  | 
            ||
| 1292 | ),  | 
            ||
| 1293 | 'payment_method' => array(  | 
            ||
| 1294 | 'description' => __( 'Payment method ID.', 'woocommerce' ),  | 
            ||
| 1295 | 'type' => 'string',  | 
            ||
| 1296 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1297 | ),  | 
            ||
| 1298 | 'payment_method_title' => array(  | 
            ||
| 1299 | 'description' => __( 'Payment method title.', 'woocommerce' ),  | 
            ||
| 1300 | 'type' => 'string',  | 
            ||
| 1301 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1302 | ),  | 
            ||
| 1303 | 'set_paid' => array(  | 
            ||
| 1304 | 'description' => __( 'Define if the order is paid. It will set the status to processing and reduce stock items.', 'woocommerce' ),  | 
            ||
| 1305 | 'type' => 'boolean',  | 
            ||
| 1306 | 'default' => false,  | 
            ||
| 1307 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1308 | 'writeonly' => true,  | 
            ||
| 1309 | ),  | 
            ||
| 1310 | 'transaction_id' => array(  | 
            ||
| 1311 | 'description' => __( 'Unique transaction ID.', 'woocommerce' ),  | 
            ||
| 1312 | 'type' => 'boolean',  | 
            ||
| 1313 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1314 | ),  | 
            ||
| 1315 | 'customer_ip_address' => array(  | 
            ||
| 1316 | 'description' => __( "Customer's IP address.", 'woocommerce' ),  | 
            ||
| 1317 | 'type' => 'string',  | 
            ||
| 1318 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1319 | 'readonly' => true,  | 
            ||
| 1320 | ),  | 
            ||
| 1321 | 'customer_user_agent' => array(  | 
            ||
| 1322 | 'description' => __( 'User agent of the customer.', 'woocommerce' ),  | 
            ||
| 1323 | 'type' => 'string',  | 
            ||
| 1324 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1325 | 'readonly' => true,  | 
            ||
| 1326 | ),  | 
            ||
| 1327 | 'created_via' => array(  | 
            ||
| 1328 | 'description' => __( 'Shows where the order was created.', 'woocommerce' ),  | 
            ||
| 1329 | 'type' => 'string',  | 
            ||
| 1330 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1331 | 'readonly' => true,  | 
            ||
| 1332 | ),  | 
            ||
| 1333 | 'customer_note' => array(  | 
            ||
| 1334 | 'description' => __( 'Note left by customer during checkout.', 'woocommerce' ),  | 
            ||
| 1335 | 'type' => 'string',  | 
            ||
| 1336 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1337 | ),  | 
            ||
| 1338 | 'date_completed' => array(  | 
            ||
| 1339 | 'description' => __( "The date the order was completed, in the site's timezone.", 'woocommerce' ),  | 
            ||
| 1340 | 'type' => 'date-time',  | 
            ||
| 1341 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1342 | 'readonly' => true,  | 
            ||
| 1343 | ),  | 
            ||
| 1344 | 'date_paid' => array(  | 
            ||
| 1345 | 'description' => __( "The date the order has been paid, in the site's timezone.", 'woocommerce' ),  | 
            ||
| 1346 | 'type' => 'date-time',  | 
            ||
| 1347 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1348 | 'readonly' => true,  | 
            ||
| 1349 | ),  | 
            ||
| 1350 | 'cart_hash' => array(  | 
            ||
| 1351 | 'description' => __( 'MD5 hash of cart items to ensure orders are not modified.', 'woocommerce' ),  | 
            ||
| 1352 | 'type' => 'float',  | 
            ||
| 1353 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1354 | 'readonly' => true,  | 
            ||
| 1355 | ),  | 
            ||
| 1356 | 'line_items' => array(  | 
            ||
| 1357 | 'description' => __( 'Line items data.', 'woocommerce' ),  | 
            ||
| 1358 | 'type' => 'array',  | 
            ||
| 1359 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1360 | 'properties' => array(  | 
            ||
| 1361 | 'id' => array(  | 
            ||
| 1362 | 'description' => __( 'Item ID.', 'woocommerce' ),  | 
            ||
| 1363 | 'type' => 'integer',  | 
            ||
| 1364 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1365 | 'readonly' => true,  | 
            ||
| 1366 | ),  | 
            ||
| 1367 | 'name' => array(  | 
            ||
| 1368 | 'description' => __( 'Product name.', 'woocommerce' ),  | 
            ||
| 1369 | 'type' => 'integer',  | 
            ||
| 1370 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1371 | 'readonly' => true,  | 
            ||
| 1372 | ),  | 
            ||
| 1373 | 'sku' => array(  | 
            ||
| 1374 | 'description' => __( 'Product SKU.', 'woocommerce' ),  | 
            ||
| 1375 | 'type' => 'string',  | 
            ||
| 1376 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1377 | 'readonly' => true,  | 
            ||
| 1378 | ),  | 
            ||
| 1379 | 'product_id' => array(  | 
            ||
| 1380 | 'description' => __( 'Product ID.', 'woocommerce' ),  | 
            ||
| 1381 | 'type' => 'integer',  | 
            ||
| 1382 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1383 | ),  | 
            ||
| 1384 | 'variation_id' => array(  | 
            ||
| 1385 | 'description' => __( 'Variation ID, if applicable.', 'woocommerce' ),  | 
            ||
| 1386 | 'type' => 'integer',  | 
            ||
| 1387 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1388 | ),  | 
            ||
| 1389 | 'quantity' => array(  | 
            ||
| 1390 | 'description' => __( 'Quantity ordered.', 'woocommerce' ),  | 
            ||
| 1391 | 'type' => 'integer',  | 
            ||
| 1392 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1393 | ),  | 
            ||
| 1394 | 'tax_class' => array(  | 
            ||
| 1395 | 'description' => __( 'Tax class of product.', 'woocommerce' ),  | 
            ||
| 1396 | 'type' => 'integer',  | 
            ||
| 1397 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1398 | 'readonly' => true,  | 
            ||
| 1399 | ),  | 
            ||
| 1400 | 'price' => array(  | 
            ||
| 1401 | 'description' => __( 'Product price.', 'woocommerce' ),  | 
            ||
| 1402 | 'type' => 'string',  | 
            ||
| 1403 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1404 | 'readonly' => true,  | 
            ||
| 1405 | ),  | 
            ||
| 1406 | 'subtotal' => array(  | 
            ||
| 1407 | 'description' => __( 'Line subtotal (before discounts).', 'woocommerce' ),  | 
            ||
| 1408 | 'type' => 'string',  | 
            ||
| 1409 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1410 | ),  | 
            ||
| 1411 | 'subtotal_tax' => array(  | 
            ||
| 1412 | 'description' => __( 'Line subtotal tax (before discounts).', 'woocommerce' ),  | 
            ||
| 1413 | 'type' => 'string',  | 
            ||
| 1414 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1415 | ),  | 
            ||
| 1416 | 'total' => array(  | 
            ||
| 1417 | 'description' => __( 'Line total (after discounts).', 'woocommerce' ),  | 
            ||
| 1418 | 'type' => 'string',  | 
            ||
| 1419 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1420 | ),  | 
            ||
| 1421 | 'total_tax' => array(  | 
            ||
| 1422 | 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ),  | 
            ||
| 1423 | 'type' => 'string',  | 
            ||
| 1424 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1425 | ),  | 
            ||
| 1426 | 'taxes' => array(  | 
            ||
| 1427 | 'description' => __( 'Line total tax.', 'woocommerce' ),  | 
            ||
| 1428 | 'type' => 'array',  | 
            ||
| 1429 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1430 | 'readonly' => true,  | 
            ||
| 1431 | 'properties' => array(  | 
            ||
| 1432 | 'id' => array(  | 
            ||
| 1433 | 'description' => __( 'Tax rate ID.', 'woocommerce' ),  | 
            ||
| 1434 | 'type' => 'integer',  | 
            ||
| 1435 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1436 | 'readonly' => true,  | 
            ||
| 1437 | ),  | 
            ||
| 1438 | 'total' => array(  | 
            ||
| 1439 | 'description' => __( 'Tax total.', 'woocommerce' ),  | 
            ||
| 1440 | 'type' => 'string',  | 
            ||
| 1441 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1442 | 'readonly' => true,  | 
            ||
| 1443 | ),  | 
            ||
| 1444 | 'subtotal' => array(  | 
            ||
| 1445 | 'description' => __( 'Tax subtotal.', 'woocommerce' ),  | 
            ||
| 1446 | 'type' => 'string',  | 
            ||
| 1447 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1448 | 'readonly' => true,  | 
            ||
| 1449 | ),  | 
            ||
| 1450 | ),  | 
            ||
| 1451 | ),  | 
            ||
| 1452 | 'meta' => array(  | 
            ||
| 1453 | 'description' => __( 'Line item meta data.', 'woocommerce' ),  | 
            ||
| 1454 | 'type' => 'array',  | 
            ||
| 1455 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1456 | 'readonly' => true,  | 
            ||
| 1457 | 'properties' => array(  | 
            ||
| 1458 | 'key' => array(  | 
            ||
| 1459 | 'description' => __( 'Meta key.', 'woocommerce' ),  | 
            ||
| 1460 | 'type' => 'string',  | 
            ||
| 1461 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1462 | 'readonly' => true,  | 
            ||
| 1463 | ),  | 
            ||
| 1464 | 'label' => array(  | 
            ||
| 1465 | 'description' => __( 'Meta label.', 'woocommerce' ),  | 
            ||
| 1466 | 'type' => 'string',  | 
            ||
| 1467 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1468 | 'readonly' => true,  | 
            ||
| 1469 | ),  | 
            ||
| 1470 | 'value' => array(  | 
            ||
| 1471 | 'description' => __( 'Meta value.', 'woocommerce' ),  | 
            ||
| 1472 | 'type' => 'string',  | 
            ||
| 1473 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1474 | 'readonly' => true,  | 
            ||
| 1475 | ),  | 
            ||
| 1476 | ),  | 
            ||
| 1477 | ),  | 
            ||
| 1478 | ),  | 
            ||
| 1479 | ),  | 
            ||
| 1480 | 'tax_lines' => array(  | 
            ||
| 1481 | 'description' => __( 'Tax lines data.', 'woocommerce' ),  | 
            ||
| 1482 | 'type' => 'array',  | 
            ||
| 1483 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1484 | 'readonly' => true,  | 
            ||
| 1485 | 'properties' => array(  | 
            ||
| 1486 | 'id' => array(  | 
            ||
| 1487 | 'description' => __( 'Item ID.', 'woocommerce' ),  | 
            ||
| 1488 | 'type' => 'integer',  | 
            ||
| 1489 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1490 | 'readonly' => true,  | 
            ||
| 1491 | ),  | 
            ||
| 1492 | 'rate_code' => array(  | 
            ||
| 1493 | 'description' => __( 'Tax rate code.', 'woocommerce' ),  | 
            ||
| 1494 | 'type' => 'string',  | 
            ||
| 1495 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1496 | 'readonly' => true,  | 
            ||
| 1497 | ),  | 
            ||
| 1498 | 'rate_id' => array(  | 
            ||
| 1499 | 'description' => __( 'Tax rate ID.', 'woocommerce' ),  | 
            ||
| 1500 | 'type' => 'string',  | 
            ||
| 1501 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1502 | 'readonly' => true,  | 
            ||
| 1503 | ),  | 
            ||
| 1504 | 'label' => array(  | 
            ||
| 1505 | 'description' => __( 'Tax rate label.', 'woocommerce' ),  | 
            ||
| 1506 | 'type' => 'string',  | 
            ||
| 1507 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1508 | 'readonly' => true,  | 
            ||
| 1509 | ),  | 
            ||
| 1510 | 'compound' => array(  | 
            ||
| 1511 | 'description' => __( 'Show if is a compound tax rate.', 'woocommerce' ),  | 
            ||
| 1512 | 'type' => 'boolean',  | 
            ||
| 1513 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1514 | 'readonly' => true,  | 
            ||
| 1515 | ),  | 
            ||
| 1516 | 'tax_total' => array(  | 
            ||
| 1517 | 'description' => __( 'Tax total (not including shipping taxes).', 'woocommerce' ),  | 
            ||
| 1518 | 'type' => 'string',  | 
            ||
| 1519 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1520 | 'readonly' => true,  | 
            ||
| 1521 | ),  | 
            ||
| 1522 | 'shipping_tax_total' => array(  | 
            ||
| 1523 | 'description' => __( 'Shipping tax total.', 'woocommerce' ),  | 
            ||
| 1524 | 'type' => 'string',  | 
            ||
| 1525 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1526 | 'readonly' => true,  | 
            ||
| 1527 | ),  | 
            ||
| 1528 | ),  | 
            ||
| 1529 | ),  | 
            ||
| 1530 | 'shipping_lines' => array(  | 
            ||
| 1531 | 'description' => __( 'Shipping lines data.', 'woocommerce' ),  | 
            ||
| 1532 | 'type' => 'array',  | 
            ||
| 1533 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1534 | 'properties' => array(  | 
            ||
| 1535 | 'id' => array(  | 
            ||
| 1536 | 'description' => __( 'Item ID.', 'woocommerce' ),  | 
            ||
| 1537 | 'type' => 'integer',  | 
            ||
| 1538 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1539 | 'readonly' => true,  | 
            ||
| 1540 | ),  | 
            ||
| 1541 | 'method_title' => array(  | 
            ||
| 1542 | 'description' => __( 'Shipping method name.', 'woocommerce' ),  | 
            ||
| 1543 | 'type' => 'string',  | 
            ||
| 1544 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1545 | ),  | 
            ||
| 1546 | 'method_id' => array(  | 
            ||
| 1547 | 'description' => __( 'Shipping method ID.', 'woocommerce' ),  | 
            ||
| 1548 | 'type' => 'integer',  | 
            ||
| 1549 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1550 | ),  | 
            ||
| 1551 | 'total' => array(  | 
            ||
| 1552 | 'description' => __( 'Line total (after discounts).', 'woocommerce' ),  | 
            ||
| 1553 | 'type' => 'string',  | 
            ||
| 1554 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1555 | ),  | 
            ||
| 1556 | 'total_tax' => array(  | 
            ||
| 1557 | 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ),  | 
            ||
| 1558 | 'type' => 'string',  | 
            ||
| 1559 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1560 | 'readonly' => true,  | 
            ||
| 1561 | ),  | 
            ||
| 1562 | 'taxes' => array(  | 
            ||
| 1563 | 'description' => __( 'Line total tax.', 'woocommerce' ),  | 
            ||
| 1564 | 'type' => 'array',  | 
            ||
| 1565 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1566 | 'readonly' => true,  | 
            ||
| 1567 | 'properties' => array(  | 
            ||
| 1568 | 'id' => array(  | 
            ||
| 1569 | 'description' => __( 'Tax rate ID.', 'woocommerce' ),  | 
            ||
| 1570 | 'type' => 'integer',  | 
            ||
| 1571 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1572 | 'readonly' => true,  | 
            ||
| 1573 | ),  | 
            ||
| 1574 | 'total' => array(  | 
            ||
| 1575 | 'description' => __( 'Tax total.', 'woocommerce' ),  | 
            ||
| 1576 | 'type' => 'string',  | 
            ||
| 1577 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1578 | 'readonly' => true,  | 
            ||
| 1579 | ),  | 
            ||
| 1580 | ),  | 
            ||
| 1581 | ),  | 
            ||
| 1582 | ),  | 
            ||
| 1583 | ),  | 
            ||
| 1584 | 'fee_lines' => array(  | 
            ||
| 1585 | 'description' => __( 'Fee lines data.', 'woocommerce' ),  | 
            ||
| 1586 | 'type' => 'array',  | 
            ||
| 1587 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1588 | 'properties' => array(  | 
            ||
| 1589 | 'id' => array(  | 
            ||
| 1590 | 'description' => __( 'Item ID.', 'woocommerce' ),  | 
            ||
| 1591 | 'type' => 'integer',  | 
            ||
| 1592 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1593 | 'readonly' => true,  | 
            ||
| 1594 | ),  | 
            ||
| 1595 | 'name' => array(  | 
            ||
| 1596 | 'description' => __( 'Fee name.', 'woocommerce' ),  | 
            ||
| 1597 | 'type' => 'string',  | 
            ||
| 1598 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1599 | ),  | 
            ||
| 1600 | 'tax_class' => array(  | 
            ||
| 1601 | 'description' => __( 'Tax class of fee.', 'woocommerce' ),  | 
            ||
| 1602 | 'type' => 'string',  | 
            ||
| 1603 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1604 | ),  | 
            ||
| 1605 | 'tax_status' => array(  | 
            ||
| 1606 | 'description' => __( 'Tax status of fee.', 'woocommerce' ),  | 
            ||
| 1607 | 'type' => 'string',  | 
            ||
| 1608 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1609 | ),  | 
            ||
| 1610 | 'total' => array(  | 
            ||
| 1611 | 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ),  | 
            ||
| 1612 | 'type' => 'string',  | 
            ||
| 1613 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1614 | ),  | 
            ||
| 1615 | 'total_tax' => array(  | 
            ||
| 1616 | 'description' => __( 'Line total tax (after discounts).', 'woocommerce' ),  | 
            ||
| 1617 | 'type' => 'string',  | 
            ||
| 1618 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1619 | ),  | 
            ||
| 1620 | 'taxes' => array(  | 
            ||
| 1621 | 'description' => __( 'Line total tax.', 'woocommerce' ),  | 
            ||
| 1622 | 'type' => 'array',  | 
            ||
| 1623 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1624 | 'readonly' => true,  | 
            ||
| 1625 | 'properties' => array(  | 
            ||
| 1626 | 'id' => array(  | 
            ||
| 1627 | 'description' => __( 'Tax rate ID.', 'woocommerce' ),  | 
            ||
| 1628 | 'type' => 'integer',  | 
            ||
| 1629 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1630 | 'readonly' => true,  | 
            ||
| 1631 | ),  | 
            ||
| 1632 | 'total' => array(  | 
            ||
| 1633 | 'description' => __( 'Tax total.', 'woocommerce' ),  | 
            ||
| 1634 | 'type' => 'string',  | 
            ||
| 1635 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1636 | 'readonly' => true,  | 
            ||
| 1637 | ),  | 
            ||
| 1638 | 'subtotal' => array(  | 
            ||
| 1639 | 'description' => __( 'Tax subtotal.', 'woocommerce' ),  | 
            ||
| 1640 | 'type' => 'string',  | 
            ||
| 1641 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1642 | 'readonly' => true,  | 
            ||
| 1643 | ),  | 
            ||
| 1644 | ),  | 
            ||
| 1645 | ),  | 
            ||
| 1646 | ),  | 
            ||
| 1647 | ),  | 
            ||
| 1648 | 'coupon_lines' => array(  | 
            ||
| 1649 | 'description' => __( 'Coupons line data.', 'woocommerce' ),  | 
            ||
| 1650 | 'type' => 'array',  | 
            ||
| 1651 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1652 | 'properties' => array(  | 
            ||
| 1653 | 'id' => array(  | 
            ||
| 1654 | 'description' => __( 'Item ID.', 'woocommerce' ),  | 
            ||
| 1655 | 'type' => 'integer',  | 
            ||
| 1656 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1657 | 'readonly' => true,  | 
            ||
| 1658 | ),  | 
            ||
| 1659 | 'code' => array(  | 
            ||
| 1660 | 'description' => __( 'Coupon code.', 'woocommerce' ),  | 
            ||
| 1661 | 'type' => 'string',  | 
            ||
| 1662 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1663 | ),  | 
            ||
| 1664 | 'discount' => array(  | 
            ||
| 1665 | 'description' => __( 'Discount total.', 'woocommerce' ),  | 
            ||
| 1666 | 'type' => 'string',  | 
            ||
| 1667 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1668 | ),  | 
            ||
| 1669 | 'discount_tax' => array(  | 
            ||
| 1670 | 'description' => __( 'Discount total tax.', 'woocommerce' ),  | 
            ||
| 1671 | 'type' => 'string',  | 
            ||
| 1672 | 'context' => array( 'view', 'edit' ),  | 
            ||
| 1673 | 'readonly' => true,  | 
            ||
| 1674 | ),  | 
            ||
| 1675 | ),  | 
            ||
| 1676 | ),  | 
            ||
| 1677 | ),  | 
            ||
| 1678 | );  | 
            ||
| 1679 | |||
| 1680 | return $this->add_additional_fields_schema( $schema );  | 
            ||
| 1681 | }  | 
            ||
| 1682 | |||
| 1734 | 
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.