Cancelled
Pull Request — develop (#1514)
by Naveen
58s
created
dataset/background/stages/class-sync-background-process-users-stage.php 2 patches
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -7,25 +7,25 @@  discard block
 block discarded – undo
7 7
 
8 8
 class Sync_Background_Process_Users_Stage {
9 9
 
10
-	/**
11
-	 * @var Sync_Object_Adapter_Factory
12
-	 */
13
-	private $sync_object_adapter_factory;
14
-
15
-	/**
16
-	 * Sync_Background_Process_Posts_Stage constructor.
17
-	 *
18
-	 * @param Sync_Object_Adapter_Factory $sync_object_adapter_factory
19
-	 */
20
-	function __construct( $sync_object_adapter_factory ) {
21
-		$this->sync_object_adapter_factory = $sync_object_adapter_factory;
22
-	}
23
-
24
-	function count() {
25
-
26
-		global $wpdb;
27
-		$in_post_type = $this->get_post_types_string();
28
-		$sql = "
10
+    /**
11
+     * @var Sync_Object_Adapter_Factory
12
+     */
13
+    private $sync_object_adapter_factory;
14
+
15
+    /**
16
+     * Sync_Background_Process_Posts_Stage constructor.
17
+     *
18
+     * @param Sync_Object_Adapter_Factory $sync_object_adapter_factory
19
+     */
20
+    function __construct( $sync_object_adapter_factory ) {
21
+        $this->sync_object_adapter_factory = $sync_object_adapter_factory;
22
+    }
23
+
24
+    function count() {
25
+
26
+        global $wpdb;
27
+        $in_post_type = $this->get_post_types_string();
28
+        $sql = "
29 29
 			SELECT COUNT( DISTINCT post_author )
30 30
 			FROM $wpdb->posts
31 31
 			WHERE post_type IN ('$in_post_type')
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 			";
34 34
 
35 35
 
36
-		return $wpdb->get_var( $sql );
37
-	}
36
+        return $wpdb->get_var( $sql );
37
+    }
38 38
 
39
-	function get_sync_object_adapters( $offset, $limit ) {
39
+    function get_sync_object_adapters( $offset, $limit ) {
40 40
 
41
-		global $wpdb;
42
-		$in_post_type = $this->get_post_types_string();
43
-		$sql = "
41
+        global $wpdb;
42
+        $in_post_type = $this->get_post_types_string();
43
+        $sql = "
44 44
 			SELECT DISTINCT post_author
45 45
 			FROM $wpdb->posts
46 46
 			WHERE post_type IN ('$in_post_type')
@@ -48,19 +48,19 @@  discard block
 block discarded – undo
48 48
 			LIMIT %d, %d
49 49
 			";
50 50
 
51
-		$ids = $wpdb->get_col( $wpdb->prepare( $sql, $offset, $limit ) );
51
+        $ids = $wpdb->get_col( $wpdb->prepare( $sql, $offset, $limit ) );
52 52
 
53
-		return $this->sync_object_adapter_factory->create_many( Object_Type_Enum::USER, $ids );
54
-	}
53
+        return $this->sync_object_adapter_factory->create_many( Object_Type_Enum::USER, $ids );
54
+    }
55 55
 
56
-	/**
57
-	 * @return string
58
-	 */
59
-	protected function get_post_types_string() {
60
-		$post_types   = get_post_types( array( 'public' => true ) );
61
-		$in_post_type = implode( "','", array_map( 'esc_sql', $post_types ) );
56
+    /**
57
+     * @return string
58
+     */
59
+    protected function get_post_types_string() {
60
+        $post_types   = get_post_types( array( 'public' => true ) );
61
+        $in_post_type = implode( "','", array_map( 'esc_sql', $post_types ) );
62 62
 
63
-		return $in_post_type;
64
-	}
63
+        return $in_post_type;
64
+    }
65 65
 
66 66
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	 *
18 18
 	 * @param Sync_Object_Adapter_Factory $sync_object_adapter_factory
19 19
 	 */
20
-	function __construct( $sync_object_adapter_factory ) {
20
+	function __construct($sync_object_adapter_factory) {
21 21
 		$this->sync_object_adapter_factory = $sync_object_adapter_factory;
22 22
 	}
23 23
 
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 			";
34 34
 
35 35
 
36
-		return $wpdb->get_var( $sql );
36
+		return $wpdb->get_var($sql);
37 37
 	}
38 38
 
39
-	function get_sync_object_adapters( $offset, $limit ) {
39
+	function get_sync_object_adapters($offset, $limit) {
40 40
 
41 41
 		global $wpdb;
42 42
 		$in_post_type = $this->get_post_types_string();
@@ -48,17 +48,17 @@  discard block
 block discarded – undo
48 48
 			LIMIT %d, %d
49 49
 			";
50 50
 
51
-		$ids = $wpdb->get_col( $wpdb->prepare( $sql, $offset, $limit ) );
51
+		$ids = $wpdb->get_col($wpdb->prepare($sql, $offset, $limit));
52 52
 
53
-		return $this->sync_object_adapter_factory->create_many( Object_Type_Enum::USER, $ids );
53
+		return $this->sync_object_adapter_factory->create_many(Object_Type_Enum::USER, $ids);
54 54
 	}
55 55
 
56 56
 	/**
57 57
 	 * @return string
58 58
 	 */
59 59
 	protected function get_post_types_string() {
60
-		$post_types   = get_post_types( array( 'public' => true ) );
61
-		$in_post_type = implode( "','", array_map( 'esc_sql', $post_types ) );
60
+		$post_types   = get_post_types(array('public' => true));
61
+		$in_post_type = implode("','", array_map('esc_sql', $post_types));
62 62
 
63 63
 		return $in_post_type;
64 64
 	}
Please login to merge, or discard this patch.