Code Duplication    Length = 26-26 lines in 2 locations

includes/api/class-wc-rest-shipping-methods-controller.php 1 location

@@ 183-208 (lines=26) @@
180
	 *
181
	 * @return array
182
	 */
183
	public function get_item_schema() {
184
		$schema = array(
185
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
186
			'title'      => 'shipping_method',
187
			'type'       => 'object',
188
			'properties' => array(
189
                'id' => array(
190
                    'description' => __( 'Method ID.', 'woocommerce' ),
191
                    'type'        => 'string',
192
                    'context'     => array( 'view' ),
193
                ),
194
                'title' => array(
195
                    'description' => __( 'Shipping method title.', 'woocommerce' ),
196
                    'type'        => 'string',
197
                    'context'     => array( 'view' ),
198
                ),
199
                'description' => array(
200
                    'description' => __( 'Shipping method description.', 'woocommerce' ),
201
                    'type'        => 'string',
202
                    'context'     => array( 'view' ),
203
                ),
204
			),
205
		);
206
207
		return $this->add_additional_fields_schema( $schema );
208
	}
209
210
	/**
211
	 * Get any query params needed.

includes/api/class-wc-rest-tax-classes-controller.php 1 location

@@ 318-343 (lines=26) @@
315
	 *
316
	 * @return array
317
	 */
318
	public function get_item_schema() {
319
		$schema = array(
320
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
321
			'title'      => 'tax_class',
322
			'type'       => 'object',
323
			'properties' => array(
324
				'slug' => array(
325
					'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
326
					'type'        => 'string',
327
					'context'     => array( 'view', 'edit' ),
328
					'readonly'    => true,
329
				),
330
				'name' => array(
331
					'description' => __( 'Tax class name.', 'woocommerce' ),
332
					'type'        => 'string',
333
					'context'     => array( 'view', 'edit' ),
334
					'required'    => true,
335
					'arg_options' => array(
336
						'sanitize_callback' => 'sanitize_text_field',
337
					),
338
				),
339
			),
340
		);
341
342
		return $this->add_additional_fields_schema( $schema );
343
	}
344
345
	/**
346
	 * Get the query params for collections.