@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @return Queue |
| 23 | 23 | */ |
| 24 | - public static function resolve( $connection ) { |
|
| 25 | - if ( isset( static::$instances[ $connection ] ) ) { |
|
| 26 | - return static::$instances[ $connection ]; |
|
| 24 | + public static function resolve($connection) { |
|
| 25 | + if (isset(static::$instances[$connection])) { |
|
| 26 | + return static::$instances[$connection]; |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - return static::build( $connection ); |
|
| 29 | + return static::build($connection); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -37,16 +37,16 @@ discard block |
||
| 37 | 37 | * @return Queue |
| 38 | 38 | * @throws \Exception |
| 39 | 39 | */ |
| 40 | - protected static function build( $connection ) { |
|
| 40 | + protected static function build($connection) { |
|
| 41 | 41 | $connections = static::connections(); |
| 42 | 42 | |
| 43 | - if ( empty( $connections[ $connection ] ) ) { |
|
| 43 | + if (empty($connections[$connection])) { |
|
| 44 | 44 | throw new ConnectionNotFoundException(); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - static::$instances[ $connection ] = new Queue( $connections[ $connection ] ); |
|
| 47 | + static::$instances[$connection] = new Queue($connections[$connection]); |
|
| 48 | 48 | |
| 49 | - return static::$instances[ $connection ]; |
|
| 49 | + return static::$instances[$connection]; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -56,11 +56,11 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | protected static function connections() { |
| 58 | 58 | $connections = array( |
| 59 | - 'database' => new DatabaseConnection( $GLOBALS['wpdb'] ), |
|
| 59 | + 'database' => new DatabaseConnection($GLOBALS['wpdb']), |
|
| 60 | 60 | 'redis' => new RedisConnection(), |
| 61 | 61 | 'sync' => new SyncConnection(), |
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | - return apply_filters( 'wp_queue_connections', $connections ); |
|
| 64 | + return apply_filters('wp_queue_connections', $connections); |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use WP_Queue\Queue; |
| 4 | 4 | use WP_Queue\QueueManager; |
| 5 | 5 | |
| 6 | -if ( ! function_exists( 'wp_queue' ) ) { |
|
| 6 | +if ( ! function_exists('wp_queue')) { |
|
| 7 | 7 | /** |
| 8 | 8 | * Return Queue instance. |
| 9 | 9 | * |
@@ -11,23 +11,23 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | * @return Queue |
| 13 | 13 | */ |
| 14 | - function wp_queue( $connection = '' ) { |
|
| 15 | - if( empty( $connection ) ) { |
|
| 16 | - $connection = apply_filters( 'wp_queue_default_connection', 'database' ); |
|
| 14 | + function wp_queue($connection = '') { |
|
| 15 | + if (empty($connection)) { |
|
| 16 | + $connection = apply_filters('wp_queue_default_connection', 'database'); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - return QueueManager::resolve( $connection ); |
|
| 19 | + return QueueManager::resolve($connection); |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -if ( ! function_exists( 'wp_queue_install_tables' ) ) { |
|
| 23 | +if ( ! function_exists('wp_queue_install_tables')) { |
|
| 24 | 24 | /** |
| 25 | 25 | * Install database tables |
| 26 | 26 | */ |
| 27 | 27 | function wp_queue_install_tables() { |
| 28 | 28 | global $wpdb; |
| 29 | 29 | |
| 30 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
| 30 | + require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
| 31 | 31 | |
| 32 | 32 | $wpdb->hide_errors(); |
| 33 | 33 | $charset_collate = $wpdb->get_charset_collate(); |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | PRIMARY KEY (id) |
| 43 | 43 | ) $charset_collate;"; |
| 44 | 44 | |
| 45 | - dbDelta( $sql ); |
|
| 45 | + dbDelta($sql); |
|
| 46 | 46 | |
| 47 | 47 | $sql = "CREATE TABLE {$wpdb->prefix}queue_failures ( |
| 48 | 48 | id bigint(20) NOT NULL AUTO_INCREMENT, |
@@ -52,6 +52,6 @@ discard block |
||
| 52 | 52 | PRIMARY KEY (id) |
| 53 | 53 | ) $charset_collate;"; |
| 54 | 54 | |
| 55 | - dbDelta( $sql ); |
|
| 55 | + dbDelta($sql); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |