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