More abstract methods

This commit is contained in:
Mike Jolley 2019-06-13 16:54:53 +01:00
parent 85f980d865
commit 1a98d24b38
1 changed files with 4 additions and 10 deletions

View File

@ -143,12 +143,9 @@ abstract class AbstractObjectsController extends AbstractController {
* @since 3.0.0 * @since 3.0.0
* @param \WC_Data $object Object data. * @param \WC_Data $object Object data.
* @param \WP_REST_Request $request Request object. * @param \WP_REST_Request $request Request object.
* @return \WP_Error|\WP_REST_Response Response object on success, or \WP_Error object on failure. * @return \WP_REST_Response Response object on success, or \WP_Error object on failure.
*/ */
protected function prepare_object_for_response( $object, $request ) { abstract protected function prepare_object_for_response( $object, $request );
// translators: %s: Class method name.
return new \WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
}
/** /**
* Prepares one object for create or update operation. * Prepares one object for create or update operation.
@ -156,12 +153,9 @@ abstract class AbstractObjectsController extends AbstractController {
* @since 3.0.0 * @since 3.0.0
* @param \WP_REST_Request $request Request object. * @param \WP_REST_Request $request Request object.
* @param bool $creating If is creating a new object. * @param bool $creating If is creating a new object.
* @return \WP_Error|\WC_Data The prepared item, or \WP_Error object on failure. * @return \WC_Data The prepared item, or \WP_Error object on failure.
*/ */
protected function prepare_object_for_database( $request, $creating = false ) { abstract protected function prepare_object_for_database( $request, $creating = false );
// translators: %s: Class method name.
return new \WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass.", 'woocommerce' ), __METHOD__ ), array( 'status' => 405 ) );
}
/** /**
* Get a single item. * Get a single item.