| Conditions | 1 |
| Paths | 1 |
| Total Lines | 114 |
| Code Lines | 91 |
| 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 |
||
| 225 | public function get_item_schema() { |
||
| 226 | $schema = array( |
||
| 227 | '$schema' => 'http://json-schema.org/draft-04/schema#', |
||
| 228 | 'title' => 'continent', |
||
| 229 | 'type' => 'object', |
||
| 230 | 'properties' => array( |
||
| 231 | 'code' => array( |
||
| 232 | 'type' => 'string', |
||
| 233 | 'description' => __( '2 character continent code.', 'woocommerce' ), |
||
| 234 | 'context' => array( 'view' ), |
||
| 235 | 'readonly' => true, |
||
| 236 | ), |
||
| 237 | 'name' => array( |
||
| 238 | 'type' => 'string', |
||
| 239 | 'description' => __( 'Full name of continent.', 'woocommerce' ), |
||
| 240 | 'context' => array( 'view' ), |
||
| 241 | 'readonly' => true, |
||
| 242 | ), |
||
| 243 | 'countries' => array( |
||
| 244 | 'type' => 'array', |
||
| 245 | 'description' => __( 'List of countries on this continent.', 'woocommerce' ), |
||
| 246 | 'context' => array( 'view' ), |
||
| 247 | 'readonly' => true, |
||
| 248 | 'items' => array( |
||
| 249 | 'type' => 'object', |
||
| 250 | 'context' => array( 'view' ), |
||
| 251 | 'readonly' => true, |
||
| 252 | 'properties' => array( |
||
| 253 | 'code' => array( |
||
| 254 | 'type' => 'string', |
||
| 255 | 'description' => __( 'ISO3166 alpha-2 country code.', 'woocommerce' ), |
||
| 256 | 'context' => array( 'view' ), |
||
| 257 | 'readonly' => true, |
||
| 258 | ), |
||
| 259 | 'currency_code' => array( |
||
| 260 | 'type' => 'string', |
||
| 261 | 'description' => __( 'Default ISO4127 alpha-3 currency code for the country.', 'woocommerce' ), |
||
| 262 | 'context' => array( 'view' ), |
||
| 263 | 'readonly' => true, |
||
| 264 | ), |
||
| 265 | 'currency_pos' => array( |
||
| 266 | 'type' => 'string', |
||
| 267 | 'description' => __( 'Currency symbol position for this country.', 'woocommerce' ), |
||
| 268 | 'context' => array( 'view' ), |
||
| 269 | 'readonly' => true, |
||
| 270 | ), |
||
| 271 | 'decimal_sep' => array( |
||
| 272 | 'type' => 'string', |
||
| 273 | 'description' => __( 'Decimal separator for displayed prices for this country.', 'woocommerce' ), |
||
| 274 | 'context' => array( 'view' ), |
||
| 275 | 'readonly' => true, |
||
| 276 | ), |
||
| 277 | 'dimension_unit' => array( |
||
| 278 | 'type' => 'string', |
||
| 279 | 'description' => __( 'The unit lengths are defined in for this country.', 'woocommerce' ), |
||
| 280 | 'context' => array( 'view' ), |
||
| 281 | 'readonly' => true, |
||
| 282 | ), |
||
| 283 | 'name' => array( |
||
| 284 | 'type' => 'string', |
||
| 285 | 'description' => __( 'Full name of country.', 'woocommerce' ), |
||
| 286 | 'context' => array( 'view' ), |
||
| 287 | 'readonly' => true, |
||
| 288 | ), |
||
| 289 | 'num_decimals' => array( |
||
| 290 | 'type' => 'integer', |
||
| 291 | 'description' => __( 'Number of decimal points shown in displayed prices for this country.', 'woocommerce' ), |
||
| 292 | 'context' => array( 'view' ), |
||
| 293 | 'readonly' => true, |
||
| 294 | ), |
||
| 295 | 'states' => array( |
||
| 296 | 'type' => 'array', |
||
| 297 | 'description' => __( 'List of states in this country.', 'woocommerce' ), |
||
| 298 | 'context' => array( 'view' ), |
||
| 299 | 'readonly' => true, |
||
| 300 | 'items' => array( |
||
| 301 | 'type' => 'object', |
||
| 302 | 'context' => array( 'view' ), |
||
| 303 | 'readonly' => true, |
||
| 304 | 'properties' => array( |
||
| 305 | 'code' => array( |
||
| 306 | 'type' => 'string', |
||
| 307 | 'description' => __( 'State code.', 'woocommerce' ), |
||
| 308 | 'context' => array( 'view' ), |
||
| 309 | 'readonly' => true, |
||
| 310 | ), |
||
| 311 | 'name' => array( |
||
| 312 | 'type' => 'string', |
||
| 313 | 'description' => __( 'Full name of state.', 'woocommerce' ), |
||
| 314 | 'context' => array( 'view' ), |
||
| 315 | 'readonly' => true, |
||
| 316 | ), |
||
| 317 | ), |
||
| 318 | ), |
||
| 319 | ), |
||
| 320 | 'thousand_sep' => array( |
||
| 321 | 'type' => 'string', |
||
| 322 | 'description' => __( 'Thousands separator for displayed prices in this country.', 'woocommerce' ), |
||
| 323 | 'context' => array( 'view' ), |
||
| 324 | 'readonly' => true, |
||
| 325 | ), |
||
| 326 | 'weight_unit' => array( |
||
| 327 | 'type' => 'string', |
||
| 328 | 'description' => __( 'The unit weights are defined in for this country.', 'woocommerce' ), |
||
| 329 | 'context' => array( 'view' ), |
||
| 330 | 'readonly' => true, |
||
| 331 | ), |
||
| 332 | ), |
||
| 333 | ), |
||
| 334 | ), |
||
| 335 | ), |
||
| 336 | ); |
||
| 337 | |||
| 338 | return $this->add_additional_fields_schema( $schema ); |
||
| 339 | } |
||
| 341 |