Fix PHPCS errors in WC_Queue class

This commit is contained in:
Gerhard Potgieter 2018-08-01 20:07:14 +02:00
parent 71f67b0f2b
commit 883a5f90eb
1 changed files with 8 additions and 4 deletions

View File

@ -34,12 +34,14 @@ class WC_Queue {
protected static $default_cass = 'WC_Action_Queue';
/**
* Single instance of WC_Queue_Interface
*
* @return WC_Queue_Interface
*/
final public static function instance() {
if ( is_null( self::$instance ) ) {
$class = self::get_class();
$class = self::get_class();
self::$instance = new $class();
self::$instance = self::validate_instance( self::$instance );
}
@ -50,7 +52,7 @@ class WC_Queue {
* Get class to instantiate
*
* And make sure 3rd party code has the chance to attach a custom queue class.
*
*
* @return string
*/
protected static function get_class() {
@ -62,13 +64,15 @@ class WC_Queue {
}
/**
* Enforce a WC_Queue_Interface is
*
* Enforce a WC_Queue_Interface
*
* @param WC_Queue_Interface $instance Instance class.
* @return WC_Queue_Interface
*/
protected static function validate_instance( $instance ) {
if ( false === ( $instance instanceof WC_Queue_Interface ) ) {
$default_class = self::$default_cass;
/* translators: %s: Default class name */
wc_doing_it_wrong( __FUNCTION__, sprintf( __( 'The class attached to the "woocommerce_queue_class" does not implement the WC_Queue_Interface interface. The default %s class will be used instead.', 'woocommerce' ), $default_class ), '3.5.0' );
$instance = new $default_class();
}